[auth] ldap backup, implement CAS_LDAP_ATTRS_VIEW set to 0

This commit is contained in:
Valentin Samir 2020-09-03 15:41:31 +02:00
parent 85426ded17
commit f0f4ec0bdc

View file

@ -391,12 +391,13 @@ class LdapAuthUser(DBAuthUser): # pragma: no cover
or :class:`list` of :func:`unicode`. If the user do not exists, the returned
:class:`dict` is empty.
:rtype: dict
:raises NotImplementedError: if the password check method in `CAS_LDAP_PASSWORD_CHECK`
do not allow to fetch the attributes without the user credentials.
"""
if settings.CAS_LDAP_PASSWORD_CHECK == "bind" and settings.CAS_LDAP_ATTRS_VIEW == 1:
if settings.CAS_LDAP_PASSWORD_CHECK == "bind":
if settings.CAS_LDAP_ATTRS_VIEW == 1:
user = UserAttributes.objects.get(username=self.username)
return user.attributs
else:
return self.user
else:
return super(LdapAuthUser, self).attributs()