Commit ec9b1071 authored by Recteur LP's avatar Recteur LP
Browse files

fix python 2

parent 7d8a2f28
......@@ -78,10 +78,9 @@ class auth():
attributes=ALL_ATTRIBUTES,
get_operational_attributes=True
)
results = self.connection.response
return self.connection.response
else:
results = self.ld.search_s(group,ldap.SCOPE_SUBTREE)
return results
return self.ld.search_s(group,ldap.SCOPE_SUBTREE)
def getusersfromgroup(self, group):
users = []
......@@ -92,6 +91,7 @@ class auth():
users.append({ "name": attrs.get('sAMAccountName', [ 'Guest' ])[0], "uid": attrs.get('uidNumber', [ 'None' ])[0] })
else:
for dn, attrs in self.__getresults(group):
if dn and attrs:
users.append({ "name": attrs.get('sAMAccountName', [ 'Guest' ])[0], "uid": attrs.get('uidNumber', [ 'None' ])[0] })
return users
......@@ -145,7 +145,7 @@ class auth():
isadmin = False
admins = []
for group in self.config['admin']:
admins = self.getusersfromgroup("(&(memberOf=" + group + "))")
admins = self.getusersfromgroup("memberOf=" + group)
for admin in admins:
pyrmin.log.debug(admin)
if 'name' in admin and name.lower() == admin['name'].lower():
......
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