mirror of
https://github.com/Kozea/Radicale.git
synced 2025-06-26 16:45:52 +00:00
fix(auth/ldap): Extract user attribute from list in _login3
This commit modifies `_login3` to check if the attribute value is a list and, if so, extracts the first element (`[0]`) as the login identifier. If the value is not a list, it's used directly (fallback).
This commit is contained in:
parent
a64a774ef1
commit
24138389ed
1 changed files with 4 additions and 1 deletions
|
@ -248,6 +248,9 @@ class Auth(auth.BaseAuth):
|
||||||
logger.debug("_login3 LDAP groups of user: %s", ",".join(self._ldap_groups))
|
logger.debug("_login3 LDAP groups of user: %s", ",".join(self._ldap_groups))
|
||||||
if self._ldap_user_attr:
|
if self._ldap_user_attr:
|
||||||
if user_entry['attributes'][self._ldap_user_attr]:
|
if user_entry['attributes'][self._ldap_user_attr]:
|
||||||
|
if isinstance(user_entry['attributes'][self._ldap_user_attr], list):
|
||||||
|
login = user_entry['attributes'][self._ldap_user_attr][0]
|
||||||
|
else:
|
||||||
login = user_entry['attributes'][self._ldap_user_attr]
|
login = user_entry['attributes'][self._ldap_user_attr]
|
||||||
logger.debug(f"_login3 user set to: '{login}'")
|
logger.debug(f"_login3 user set to: '{login}'")
|
||||||
conn.unbind()
|
conn.unbind()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue