auth: Convert `get_mapped_name()` in LDAP backend to a class method.

This commit is contained in:
Harshit Bansal 2019-01-16 08:06:11 +00:00 committed by Tim Abbott
parent 5ba84d75ce
commit 4ec82b28f7
1 changed files with 2 additions and 1 deletions

View File

@ -312,7 +312,8 @@ class ZulipLDAPAuthBackendBase(ZulipAuthMixin, LDAPBackend):
ldap_disabled = bool(int(account_control_value) & LDAP_USER_ACCOUNT_CONTROL_DISABLED_MASK) ldap_disabled = bool(int(account_control_value) & LDAP_USER_ACCOUNT_CONTROL_DISABLED_MASK)
return ldap_disabled return ldap_disabled
def get_mapped_name(self, ldap_user: _LDAPUser) -> Tuple[str, str]: @classmethod
def get_mapped_name(cls, ldap_user: _LDAPUser) -> Tuple[str, str]:
if "full_name" in settings.AUTH_LDAP_USER_ATTR_MAP: if "full_name" in settings.AUTH_LDAP_USER_ATTR_MAP:
full_name_attr = settings.AUTH_LDAP_USER_ATTR_MAP["full_name"] full_name_attr = settings.AUTH_LDAP_USER_ATTR_MAP["full_name"]
short_name = full_name = ldap_user.attrs[full_name_attr][0] short_name = full_name = ldap_user.attrs[full_name_attr][0]