1
0
Fork 0
mirror of https://github.com/kakwa/ldapcherry synced 2025-07-04 12:27:47 +02:00

list of roles and not a uniq role for get_groups

This commit is contained in:
kakwa 2015-06-18 10:04:20 +02:00
parent af5fd8eeae
commit 01de849204
2 changed files with 11 additions and 5 deletions

View file

@ -307,11 +307,17 @@ class Roles:
raise MissingRole(role)
return self.flatten[role]['display_name']
def get_groups(self, role):
def get_groups(self, roles):
"""get the list of groups from role"""
if not role in self.flatten:
raise MissingRole(role)
return self.flatten[role]['backends_groups']
ret = {}
for role in roles:
if not role in self.flatten:
raise MissingRole(role)
for b in self.flatten[role]['backends_groups']:
if b not in ret:
ret[b] = []
ret[b] = ret[b] + self.flatten[role]['backends_groups'][b]
return ret
def is_admin(self, roles):
"""determine from a list of roles if is ldapcherry administrator"""