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

make the key attribute not modifiable in modify form

This commit is contained in:
kakwa 2015-06-25 02:08:30 +02:00
parent 830e00a404
commit 45f32df72e
2 changed files with 6 additions and 2 deletions

View File

@ -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)

View File

@ -36,7 +36,10 @@ for a in sorted(attributes.keys(), key=lambda attr: attributes[attr]['weight']):
%>
<span class="input-group-addon" id="basic-addon1">${attr['display_name']}</span>
% if attr['type'] == 'string':
% if modify and a == keyattr:
<input type="hidden" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1" ${required} ${value}>
<span class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1">${tmp}</span>
% elif attr['type'] == 'string':
<input type="text" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1" ${required} ${value}>
% elif attr['type'] == 'email':
<input type="email" name="attr.${a}" class="form-control" placeholder="${attr['description']}" aria-describedby="basic-addon1" ${required} ${value} data-error="email address is invalid">