1👍
✅
Group membership, as django-auth-ldap uses the term, doesn’t have anything to do with directory tree structure. CN=my_user,OU=mygroup,OU=users,DC=myserver
is not a member of OU=mygroup,OU=users,DC=myserver
in this sense, it just happens to be a sub-DN. If you want to assign Django user properties based on arbitrary attributes (including DN), you can attach a signal handler to django_auth_ldap.backend.populate_user.
Source:stackexchange.com