From 985d477ef6019d48c0fe1a29ce2dd24ec7e26504 Mon Sep 17 00:00:00 2001 From: jedi Date: Thu, 28 Oct 2021 02:36:38 +0200 Subject: [PATCH] query groups for ldap users --- backend/backend/settings.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/backend/settings.py b/backend/backend/settings.py index bf7e141..1714f7e 100644 --- a/backend/backend/settings.py +++ b/backend/backend/settings.py @@ -31,7 +31,7 @@ DEBUG = True ALLOWED_HOSTS = [] 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_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 ) + +AUTH_LDAP_GROUP_TYPE = GroupOfNamesType() + +AUTH_LDAP_GROUP_SEARCH = LDAPSearch( + 'ou=roles,dc=neulandlabor,dc=de', + ldap.SCOPE_ONELEVEL, + '(objectClass=groupOfNames)', +) + AUTHENTICATION_BACKENDS = [ "django_auth_ldap.backend.LDAPBackend", "django.contrib.auth.backends.ModelBackend",