From f0f4ec0bdcb22ac46265e0bfd301e456fea708bc Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Thu, 3 Sep 2020 15:41:31 +0200 Subject: [PATCH] [auth] ldap backup, implement CAS_LDAP_ATTRS_VIEW set to 0 --- cas_server/auth.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cas_server/auth.py b/cas_server/auth.py index 24f3881..2741c97 100644 --- a/cas_server/auth.py +++ b/cas_server/auth.py @@ -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: - user = UserAttributes.objects.get(username=self.username) - return user.attributs + 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()