1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-22 09:24:21 +01:00

implementing various methods:

* get_groups (get_groups of a role)
* is_admin (determine if ldapcherry admin)
* get_backends (get list of role backends)
This commit is contained in:
kakwa 2015-05-16 20:03:34 +02:00
parent 17499c82ae
commit 87820da7d0

View File

@ -82,8 +82,9 @@ class Roles:
for backend in role['backends']: for backend in role['backends']:
self.backends.add(backend) self.backends.add(backend)
#if 'LC_admins' in role and role['LC_admins']: # Create the list of roles which are ldapcherry admins
# self.admin_roles.append(roleid) if 'LC_admins' in role and role['LC_admins']:
self.admin_roles.append(roleid)
# Create the nested groups # Create the nested groups
for roleid in self.roles_raw: for roleid in self.roles_raw:
@ -185,6 +186,17 @@ class Roles:
ret['unusedgroups'] = unusedgroups ret['unusedgroups'] = unusedgroups
return ret return ret
def get_groups(self, roles): def get_groups(self, role):
"""get the list of groups from roles""" """get the list of groups from role"""
pass return self.roles_raw[role]['backends']
def is_admin(self, roles):
"""determine from a list of roles if is ldapcherry administrator"""
for r in roles:
if r in self.admin_roles:
return True
return False
def get_backends(self):
"""return the list of backends in roles file"""
return self.backends