|
2 | 2 | from os import environ |
3 | 3 |
|
4 | 4 | import ldap |
5 | | -from django_auth_ldap.config import LDAPGroupQuery, LDAPSearch |
| 5 | +from django_auth_ldap.config import LDAPSearch |
6 | 6 |
|
7 | 7 |
|
8 | 8 | # Read secret from file |
@@ -86,22 +86,12 @@ def _import_group_type(group_type_name): |
86 | 86 | # Define a group required to login. |
87 | 87 | AUTH_LDAP_REQUIRE_GROUP = environ.get('AUTH_LDAP_REQUIRE_GROUP_DN') |
88 | 88 |
|
89 | | -# If non-empty string, AUTH_LDAP_REQUIRE_GROUP will be treated as a list delimited by this separator |
90 | | -AUTH_LDAP_REQUIRE_GROUP_SEPARATOR = environ.get('AUTH_LDAP_REQUIRE_GROUP_DN_SEPARATOR', '') |
91 | | - |
92 | 89 | # Define special user types using groups. Exercise great caution when assigning superuser status. |
93 | 90 | AUTH_LDAP_USER_FLAGS_BY_GROUP = {} |
94 | 91 |
|
95 | 92 | if AUTH_LDAP_REQUIRE_GROUP is not None: |
96 | | - # Build an LDAPGroupQuery when AUTH_LDAP_REQUIRE_GROUP should be treated as a list |
97 | | - if AUTH_LDAP_REQUIRE_GROUP_SEPARATOR: |
98 | | - _groups = list(filter(None, AUTH_LDAP_REQUIRE_GROUP.split(AUTH_LDAP_REQUIRE_GROUP_SEPARATOR))) |
99 | | - AUTH_LDAP_REQUIRE_GROUP = LDAPGroupQuery(_groups[0]) |
100 | | - for i in range(1, len(_groups)): |
101 | | - AUTH_LDAP_REQUIRE_GROUP |= LDAPGroupQuery(_groups[i]) |
102 | | - |
103 | 93 | AUTH_LDAP_USER_FLAGS_BY_GROUP = { |
104 | | - "is_active": AUTH_LDAP_REQUIRE_GROUP, |
| 94 | + "is_active": environ.get('AUTH_LDAP_REQUIRE_GROUP_DN', ''), |
105 | 95 | "is_staff": environ.get('AUTH_LDAP_IS_ADMIN_DN', ''), |
106 | 96 | "is_superuser": environ.get('AUTH_LDAP_IS_SUPERUSER_DN', '') |
107 | 97 | } |
|
0 commit comments