Commit c43de5db authored by Daniel Klaffenbach's avatar Daniel Klaffenbach 🐍

ldap: Fix handling of empty attributes

parent 8c7f67d7
Pipeline #4838 passed with stage
in 36 seconds
......@@ -49,6 +49,6 @@ class Ldap(object):
model_attrs = {}
if conn.search(self.LDAP_PARAMS['base'], '(uid=%s)' %username, attributes=self.LDAP_SYNC_USER_ATTRIBUTES.keys()):
for attr in self.LDAP_SYNC_USER_ATTRIBUTES:
if attr in conn.response[0]['attributes']:
if attr in conn.response[0]['attributes'] and conn.response[0]['attributes'][attr]:
model_attrs[self.LDAP_SYNC_USER_ATTRIBUTES[attr]] = conn.response[0]['attributes'][attr][0]
return model_attrs
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment