query groups for ldap users

This commit is contained in:
j3d1 2021-10-28 02:36:38 +02:00
parent 5fce1fb288
commit 985d477ef6

View file

@ -31,7 +31,7 @@ DEBUG = True
ALLOWED_HOSTS = [] ALLOWED_HOSTS = []
import ldap import ldap
from django_auth_ldap.config import LDAPSearch from django_auth_ldap.config import LDAPSearch, GroupOfNamesType
AUTH_LDAP_SERVER_URI = config.ldap.uri AUTH_LDAP_SERVER_URI = config.ldap.uri
AUTH_LDAP_BIND_DN = config.ldap.bind_dn AUTH_LDAP_BIND_DN = config.ldap.bind_dn
@ -40,6 +40,15 @@ AUTH_LDAP_USER_SEARCH = LDAPSearch(
config.ldap.search_dn, ldap.SCOPE_SUBTREE, config.ldap.search_filter config.ldap.search_dn, ldap.SCOPE_SUBTREE, config.ldap.search_filter
) )
AUTH_LDAP_GROUP_TYPE = GroupOfNamesType()
AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
'ou=roles,dc=neulandlabor,dc=de',
ldap.SCOPE_ONELEVEL,
'(objectClass=groupOfNames)',
)
AUTHENTICATION_BACKENDS = [ AUTHENTICATION_BACKENDS = [
"django_auth_ldap.backend.LDAPBackend", "django_auth_ldap.backend.LDAPBackend",
"django.contrib.auth.backends.ModelBackend", "django.contrib.auth.backends.ModelBackend",