From 8d08cf0284b204f51eb12818d05d3e8d096c667b Mon Sep 17 00:00:00 2001 From: kakwa Date: Wed, 10 Jun 2015 19:59:35 +0200 Subject: [PATCH] implementing roles switchs on forms --- ldapcherry/__init__.py | 5 +++- resources/templates/adduser.tmpl | 3 +++ resources/templates/roles.tmpl | 39 ++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/ldapcherry/__init__.py b/ldapcherry/__init__.py index 97828f0..ebaab03 100644 --- a/ldapcherry/__init__.py +++ b/ldapcherry/__init__.py @@ -287,6 +287,8 @@ class LdapCherry(object): self.temp_searchadmin = self.temp_lookup.get_template('searchadmin.tmpl') self.temp_searchuser = self.temp_lookup.get_template('searchuser.tmpl') self.temp_adduser = self.temp_lookup.get_template('adduser.tmpl') + self.temp_roles = self.temp_lookup.get_template('roles.tmpl') + self.temp_groups = self.temp_lookup.get_template('groups.tmpl') self.temp_form = self.temp_lookup.get_template('form.tmpl') self.temp_selfmodify = self.temp_lookup.get_template('selfmodify.tmpl') @@ -446,7 +448,8 @@ class LdapCherry(object): """ add user page """ self._check_auth(must_admin=True) form = self.temp_form.render(attributes=self.attributes.attributes, values=None) - return self.temp_adduser.render(form=form) + roles = self.temp_roles.render(roles=self.roles.flatten, graph=self.roles.graph) + return self.temp_adduser.render(form=form, roles=roles) @cherrypy.expose def delete(self, **params): diff --git a/resources/templates/adduser.tmpl b/resources/templates/adduser.tmpl index 5b390da..b51eb5f 100644 --- a/resources/templates/adduser.tmpl +++ b/resources/templates/adduser.tmpl @@ -6,7 +6,10 @@