LDAP and Settings files

Questions, comments, discussions. Over time certain topics might be moved to their own category.
Post Reply
morten
Posts: 3
Joined: Wed Jan 30, 2019 4:09 pm

LDAP and Settings files

Post by morten » Wed Jan 30, 2019 4:19 pm

Hi,
This product completely looks like a go-er for our internal project, however i really do need LDAP working for it to fly.
I've been following the various guides and forum posts, but cannot get it to even reference the settings files correctly.

Environment:
Ubuntu 16.0.4 LTS. Installed Mayan EDMS via the Basic Installation instructions.

I've created a simple LDAP config file that actually has nothing in it except the following:

Code: Select all

from mayan.settings.production import *
This settings file (called myconfig.py) is located /opt/mayan-edms/media/maya_settings/

Once that's done, am i right in thinking i then edit the supervisor config file? This is what I have been doing... and I've been modifying the following line to say:

Code: Select all

    DJANGO_SETTINGS_MODULE = mayan.media.mayan_settings.myconfig
But once done, supervisor doesnt start up mayan.

What am I doing wrong? Can someone help me better understand how to use LDAP, or at the very least - where to modify my settings files, and how to get them loaded correctly when using Supervisor?

TIA

daniel1113
Posts: 16
Joined: Tue Aug 21, 2018 2:32 pm

Re: LDAP and Settings files

Post by daniel1113 » Wed Jan 30, 2019 5:18 pm

It's actually incredibly simple, but the lack of documentation complicates things. Here's what you need.

First, create your settings file (ldap_settings.py or whatever). Your simple configuration file should be sufficient for testing.

Second, save it to the correct location for your deployment (direct vs. Docker): https://docs.mayan-edms.com/chapters/se ... ngs_module. Looking at your path, it looks like you have a direct deployment. If so, there's a typo in your path. It's "mayan_settings" not "maya_settings."

Third, tell Mayan to import this file. Again, this depends on your deployment. For Docker, it's as simple as setting the MAYAN_SETTINGS_MODULE variable on startup. For a file called ldap_settings.py, it is:

Code: Select all

MAYAN_SETTINGS_MODULE=mayan_settings.ldap_settings
Direct deployment is explained in the documentation linked above.

With just those changes, you should have no problem loading the settings file and implementing LDAP. I suspect the problem is due to your incorrect path above.

morten
Posts: 3
Joined: Wed Jan 30, 2019 4:09 pm

Re: LDAP and Settings files

Post by morten » Wed Jan 30, 2019 5:28 pm

thanks - I'l give this a go tomorrow.

For completeness - yes its a direct installation method, and the spelling mistake was in the forum post, not my configuration! :)

So as it's a basic direct installation, do i modify the supervisor config file - more specifically the DJANGO_SETTINGS_MODULE within it?
I note for docker you mention MAYAN_SETTINGS_MODULE.

Cheers!

simeon
Posts: 4
Joined: Thu Jan 31, 2019 10:54 am

Re: LDAP and Settings files

Post by simeon » Thu Jan 31, 2019 11:15 am

I have also been trying to do this and found there is an error in the docs:

I followed the direct deploy instructions, adapting them to CentOS 7 along the way.
The supervisord config shows a line:

Code: Select all

PYTHONPATH=/opt/mayan-edms/lib/python2.7/site-packages:/opt/mayan-edms/data,
This actually needs to be:

Code: Select all

PYTHONPATH=/opt/mayan-edms/lib/python2.7/site-packages:/opt/mayan-edms/media,
Then the docs for settings say that something like this is required:

Code: Select all

export DJANGO_SETTINGS_MODULE=mayan.media.mayan_settings.local
but this is what works:

Code: Select all

DJANGO_SETTINGS_MODULE=mayan_settings.local
Once I made the above changes then my local settings are used.

Hope that helps,
Simeon

morten
Posts: 3
Joined: Wed Jan 30, 2019 4:09 pm

Re: LDAP and Settings files

Post by morten » Thu Jan 31, 2019 3:26 pm

wow - that appears to have worked (well it hasnt errored)! Thank you !

I've used the demo config tuned accordingly from the gitlab repo - how do I test and configure the LDAP further?

I've done the obvious and logon as an AD user.. but i get "

Code: Select all

Please enter a correct username and password. Note that both fields may be case-sensitive. "
Is there anything else i need to do to tell it to do the LDAP authentication? Or - what log files does it write to for this?

Thanks!

EDIT: Scrap that.. it didnt work, i restarted supervisior, i didnt re-read it. When i re-read it and updated it, it still failed to load. However.. my question still stands - how do i check it is doing LDAP auth? Log files? anything extra i need to do?

TIA :)

Post Reply