Skip to content
Snippets Groups Projects
Unverified Commit 1e5b4b0b authored by Alexandre Ferland's avatar Alexandre Ferland Committed by GitHub
Browse files

Merge pull request #67 from nickolay/pr/groups

Fix regression in groups-related functions (".." vs b"..")
parents f4a6ab84 36f69440
No related branches found
No related tags found
No related merge requests found
......@@ -232,8 +232,8 @@ class LDAP(object):
if current_app.config['LDAP_OPENLDAP']:
group_member_filter = \
current_app.config['LDAP_GROUP_MEMBER_FILTER_FIELD']
groups = [record[1][group_member_filter][0] for
record in records]
groups = [record[1][group_member_filter][0].decode(
'utf-8') for record in records]
return groups
else:
if current_app.config['LDAP_USER_GROUPS_FIELD'] in \
......@@ -242,6 +242,7 @@ class LDAP(object):
current_app.config['LDAP_USER_GROUPS_FIELD']]
result = [re.findall(b'(?:cn=|CN=)(.*?),', group)[0]
for group in groups]
result = [r.decode('utf-8') for r in result]
return result
except ldap.LDAPError as e:
raise LDAPException(self.error(e.args))
......@@ -266,6 +267,7 @@ class LDAP(object):
records[0][1]:
members = records[0][1][
current_app.config['LDAP_GROUP_MEMBERS_FIELD']]
members = [m.decode('utf-8') for m in members]
return members
except ldap.LDAPError as e:
raise LDAPException(self.error(e.args))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment