Connect to LDAP

Hello everybody,
I’ve got Mayan up and running on docker compose. Now I want to authenticate the users against LDAP.
I found the FAQ (FAQ — Mayan EDMS 4.4.8 documentation) and adapted the file for my purposes. Now I can’t get any further with the implementation of the settings file. What is the Python settings file method. Where to put the file? Inside the docker container or outside on the server. Which directory should I use? How to read in the file? Sorry for the stupid question, but I can’t get any further. Thank you for your help in advance.


In the docker compose file you can find that the path /var/lib/mayan is mapped to the app docker volume:

- ${MAYAN_APP_VOLUME:-app}:/var/lib/mayan

so you can put your configuration file in the following path:


Note: if you changed the app name in the .env file you need yo revise the path


new path:

the example for the ldap configuration is good as mentioned in the .env file (Example Configuration — django-auth-ldap 4.4.1.dev1+g342c103.d20230722 documentation)

just a few notes to make your life easier:

1- is_superuser: will give all permissions without you seeing any role assignment in mayan (gave me hell to understand) so its not an admin privilege its like the name suggests a super admin
2- use ldap filters to limit your groups selection, for example, I used:

‘OU=,DC=,DC=', ldap.SCOPE_SUBTREE, '(&(objectClass=group)(CN=GRP_MAYAN_*))’

3- use AUTH_LDAP_FIND_GROUP_PERMS = True and AUTH_LDAP_ALWAYS_UPDATE_USER = True to update users permissions

4- to allow both local authentication and ldap use:

5- ldap groups will be created with the same name in mayan but that will happen on user login so you can create them yourself before users login to design your security beforehand (group name in mayan should have the same as in ldap)

6- you may need to import or use additional methods as per your specific use case, for example I used:

from django_auth_ldap.config import LDAPGroupQuery, LDAPSearchUnion, NestedActiveDirectoryGroupType, NestedGroupOfNamesType

‘is_active’: (
| LDAPGroupQuery(‘XXXXXXXX’)

ldap.SCOPE_SUBTREE, ‘(sAMAccountName=%(user)s)’

Hope this helps

1 Like

Hi Zee, please excuse my late reply. Thank you very much for the detailed answer. I will try to establish a connection to our LDAP server in the next few days and hope for the excellent support if I have any further questions. I appreciate the good notes that you provide.

Thank you