From 2f5d293fd6a53711db34ab4155f30a17ed5cafa1 Mon Sep 17 00:00:00 2001 From: jacob Date: Sat, 19 Jan 2019 05:12:36 -0500 Subject: [PATCH] ldap_config: resolve AUTH_LDAP_USER_SEARCH_ATTR and AUTH_LDAP_GROUP_SEARCH_CLASS from env --- configuration/ldap_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/ldap_config.py b/configuration/ldap_config.py index 1d3dbcd..40b06d1 100644 --- a/configuration/ldap_config.py +++ b/configuration/ldap_config.py @@ -25,12 +25,12 @@ LDAP_IGNORE_CERT_ERRORS = os.environ.get('LDAP_IGNORE_CERT_ERRORS', 'False').low AUTH_LDAP_USER_SEARCH = LDAPSearch(os.environ.get('AUTH_LDAP_USER_SEARCH_BASEDN', ''), ldap.SCOPE_SUBTREE, - "(sAMAccountName=%(user)s)") + "(" + os.environ.get('AUTH_LDAP_USER_SEARCH_ATTR', 'sAMAccountName') + "=%(user)s)") # This search ought to return all groups to which the user belongs. django_auth_ldap uses this to determine group # heirarchy. AUTH_LDAP_GROUP_SEARCH = LDAPSearch(os.environ.get('AUTH_LDAP_GROUP_SEARCH_BASEDN', ''), ldap.SCOPE_SUBTREE, - "(objectClass=group)") + "(objectClass=" + os.environ.get('AUTH_LDAP_GROUP_SEARCH_CLASS', 'group') + ")") AUTH_LDAP_GROUP_TYPE = GroupOfNamesType() # Define a group required to login.