[SOLVED]Django ldap authentication

Hi, I’ve to connect django web application with ucs.
I’ve problems about these settings;

# This search ought to return all groups to which the user belongs. django_auth_ldap uses this $
# hierarchy.
AUTH_LDAP_GROUP_SEARCH = LDAPSearch("cn=groups,dc=domain,dc=intranet", ldap.SCOPE_SUBTREE,
                                    "(objectClass=posixGroup)")
#AUTH_LDAP_GROUP_TYPE = GroupOfNamesType()
AUTH_LDAP_GROUP_TYPE = PosixGroupType(name_attr="uniqueMember")

with there settings I’ve this output:

name 'PosixGroupType' is not defined

What’s wrong?

This is indeed a Python name error. You need to import the class PosixGroupType correctly.

Hi, Thank you @jlk.
Can you help me about how can I correctly import class?

Regards

Hi,
as your problem has nothing to do with UCS or your LDAP in general, I would advice you to seek further help from a Python community or Stack Overflow.

This aside your import statement should look like:

from django_auth_ldap.config import PosixGroupType

Thank you @jlk, now works fine.
have a nice day

1 Like
Mastodon