config for searchuser added

This commit is contained in:
downhill 2018-10-23 16:40:34 +02:00
parent c720f21e1d
commit 260aa5e8f1
2 changed files with 12 additions and 2 deletions

View File

@ -16,12 +16,17 @@ import ldap
from django_auth_ldap.config import LDAPSearch, LDAPSearchUnion
from configparser import ConfigParser
config = ConfigParser()
config.read('djangoldap.conf')
# LDAP config
# The search user
AUTH_LDAP_BIND_DN = ""
AUTH_LDAP_BIND_DN = config['LDAP']['SEARCHUSER']
# The password for the search user
AUTH_LDAP_BIND_PASSWORD = ""
AUTH_LDAP_BIND_PASSWORD = config['LDAP']['SEARCHUSERPASSWORD']
# Search union over two ou
AUTH_LDAP_USER_SEARCH = LDAPSearchUnion(
LDAPSearch("ou=users,dc=ungleich,dc=ch", ldap.SCOPE_SUBTREE, "(uid=%(user)s)"),

View File

@ -0,0 +1,5 @@
[LDAP]
# Set up the user which can search
SEARCHUSER = uid=search,ou=system,dc=ungleich,dc=ch
SEARCHUSERPASSWORD = fnord