forkd
forkd

Reputation: 55

Django AUTH_LDAP_MIRROR_GROUPS Not working

I'm having some trouble trying to instruct Django only to synchronize some groups using LDAP integration. The documentation itself tells me that:

AUTH_LDAP_MIRROR_GROUPS

...

This can also be a list or other collection of group names, in which case we’ll only mirror those groups and leave the rest alone.

My ldap_config.py is set as follows:

import ldap

...

AUTH_LDAP_MIRROR_GROUPS = {
"NETBOX-ADM":"CN=USR-NETBOX-ADM,OU=SUPRESSED,OU=SUPRESSED,OU=SUPRESSED,OU=SUPRESSED,DC=SUPRESSED,DC=SUPRESSED,DC=SUPRESSED"
}

AUTH_LDAP_ALWAYS_UPDATE_USER = True
AUTH_LDAP_CACHE_GROUPS = False

My problem is that those group USR-NETBOX-ADM isn't synchronized to Django. If I only set AUTH_LDAP_MIRROR_GROUPS = True many groups are synchronized and I want to avoid garbage.

Upvotes: 0

Views: 2045

Answers (1)

forkd
forkd

Reputation: 55

Everything's okay right now. What I did was to assign an array with group names to be mirrored, like:

AUTH_LDAP_MIRROR_GROUPS = [
    "USR-NETBOX-USERS", "USR-NETBOX-ADM"
]

Something that could have caused confusion was that I had created manually some users before using LDAP. As those users had the same usernames in LDAP, maybe this could have caused trouble. So, I removed all users manually and everything worked fine in the next logon (using LDAP).

Upvotes: 2

Related Questions