get_attr : make case-insensitive on attribute name

This commit is contained in:
Benjamin Renard 2018-02-13 11:59:01 +01:00
parent bf420f0a81
commit 0f69b2a713

View file

@ -106,6 +106,11 @@ class LdapServer(object):
return obj[0][0]
def get_attr(self,obj,attr,all=None,default=None):
if attr not in obj:
for k in obj:
if k.lower() == attr.lower():
attr = k
break
if all is not None:
if attr in obj:
return obj[attr]