From 71c1eccc8e1ba9940713544a6a8937c65c82e92b Mon Sep 17 00:00:00 2001 From: kakwa Date: Thu, 18 Jun 2015 20:38:39 +0200 Subject: [PATCH] implementing adding user to roles --- ldapcherry/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ldapcherry/__init__.py b/ldapcherry/__init__.py index 8bf8a7b..16bae2b 100644 --- a/ldapcherry/__init__.py +++ b/ldapcherry/__init__.py @@ -421,6 +421,16 @@ class LdapCherry(object): for b in badd: self.backends[b].add_user(badd[b]) + roles = [] + for r in self.roles.get_allroles(): + if r in params: + roles.append(r) + key = self.attributes.get_key() + username = params[key] + groups = self.roles.get_groups(roles) + for b in groups: + self.backends[b].add_to_groups(username, groups[b]) + @cherrypy.expose def logout(self): """ logout page