From 45f32df72e9ecd1d6c668e473fc223601c9cb314 Mon Sep 17 00:00:00 2001 From: kakwa Date: Thu, 25 Jun 2015 02:08:30 +0200 Subject: [PATCH] make the key attribute not modifiable in modify form --- ldapcherry/__init__.py | 3 ++- resources/templates/form.tmpl | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ldapcherry/__init__.py b/ldapcherry/__init__.py index 7ec8252..f687882 100644 --- a/ldapcherry/__init__.py +++ b/ldapcherry/__init__.py @@ -748,7 +748,8 @@ class LdapCherry(object): user_roles = tmp['roles'] user_lonely_groups = tmp['unusedgroups'] roles_js = json.dumps(display_names, separators=(',',':')) - form = self.temp_form.render(attributes=self.attributes.attributes, values=user_attrs, modify=True) + key = self.attributes.get_key() + form = self.temp_form.render(attributes=self.attributes.attributes, values=user_attrs, modify=True, keyattr=key) roles = self.temp_roles.render(roles=self.roles.flatten, graph=self.roles.graph, graph_js=graph_js, roles_js=roles_js, current_roles=user_roles) return self.temp_modify.render(form=form, roles=roles, is_admin=is_admin, notification=notification, standalone_groups=user_lonely_groups) diff --git a/resources/templates/form.tmpl b/resources/templates/form.tmpl index ff38aaf..bf03400 100644 --- a/resources/templates/form.tmpl +++ b/resources/templates/form.tmpl @@ -36,7 +36,10 @@ for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']): %> ${attr['display_name']} - % if attr['type'] == 'string': + % if modify and a == keyattr: + + ${tmp} + % elif attr['type'] == 'string': % elif attr['type'] == 'email':