Skip to content
Snippets Groups Projects
Commit e6822987 authored by Jakob Berger's avatar Jakob Berger :key2: Committed by jakob
Browse files

ldap fixes

parent efd7efde
No related branches found
No related tags found
No related merge requests found
...@@ -26,8 +26,8 @@ class LdapHandler: ...@@ -26,8 +26,8 @@ class LdapHandler:
return self.connection.entries return self.connection.entries
def get_ldap_users(self, usernames: List[str], def get_ldap_users(self, usernames: List[str],
attributes: dict = {'username': 'uid', 'name': 'cn', 'mail': 'mail'}, attributes: dict = {'username': 'uid', 'name': 'cn', 'email': 'mail'},
default_vars: dict = {'provider': 'ldapmain', 'project_limit': '0', 'confirm': 'false'}, default_vars: dict = {'provider': 'ldapmain', 'project_limit': '0', 'confirm': 'false', 'password': 'oobahbah7ya5b@ohshai-1iex9kuDo$h3Faef5saeng'},
filters: dict = {}) -> List[Dict]: filters: dict = {}) -> List[Dict]:
""" Queries the ldap and prefills the user object for you. """ Queries the ldap and prefills the user object for you.
The attributes dictionary maps the names of the user object attributes to the names of the ldap fields The attributes dictionary maps the names of the user object attributes to the names of the ldap fields
...@@ -40,6 +40,7 @@ class LdapHandler: ...@@ -40,6 +40,7 @@ class LdapHandler:
users = [] users = []
for entry in results: for entry in results:
user = default_vars.copy() user = default_vars.copy()
user['extern_uid'] = entry.entry_dn
for user_field, ldap_name in attributes.items(): for user_field, ldap_name in attributes.items():
user[user_field] = entry.entry_attributes_as_dict[ldap_name][0] user[user_field] = entry.entry_attributes_as_dict[ldap_name][0]
users.append(user) users.append(user)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment