[Django]-Mapping LDAP users to Django users with Django Auth Ldap

1👍

With the help of psagers’ tips, I managed to find the answer to my issue.
First, I’m using Open Directory, so I need to use AUTH_LDAP_GROUP_TYPE = PosixGroupType(name_attr=’cn’) instead of GroupOfNamesType().
Second, mapping the ‘is_active’ flag to the entire ‘groups’ container doesn’t make sense, because I can’t login when I use it, so I took it out.

👤elbear

3👍

If you set AUTH_LDAP_GROUP_SEARCH, you also need to set AUTH_LDAP_GROUP_TYPE. Since you’re apparently using groupOfNames for grouping, you need AUTH_LDAP_GROUP_TYPE = GroupOfNamesType().

Everything else looks okay, although it’s unlikely that you need both AUTH_LDAP_MIRROR_GROUPS and AUTH_LDAP_FIND_GROUPS_PERMS. It’s probably not hurting anything, but those are meant to be alternatives.

In general, logging is your friend in cases like this.

Leave a comment