ldap.LdapClient: make get_attr case-insensitive on attribute name

This commit is contained in:
Benjamin Renard 2021-12-08 16:58:58 +01:00
parent d1102ce1b3
commit 947ed765aa

View file

@ -448,6 +448,11 @@ class LdapClient:
returned instead of the first value only returned instead of the first value only
(optinal, default: False) (optinal, default: False)
""" """
if attr not in obj:
for k in obj:
if k.lower() == attr.lower():
attr = k
break
vals = obj.get(attr, []) vals = obj.get(attr, [])
if vals: if vals:
return vals if all_values else vals[0] return vals if all_values else vals[0]