mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24:21 +01:00
implementing notification to explain automatic adding of roles
This commit is contained in:
parent
5ddaa4c44f
commit
6eece6f7ff
@ -464,8 +464,12 @@ class LdapCherry(object):
|
|||||||
p = list(self.roles.graph[r]['parent_roles'])
|
p = list(self.roles.graph[r]['parent_roles'])
|
||||||
graph[r] = { 'sub_roles': s, 'parent_roles': p}
|
graph[r] = { 'sub_roles': s, 'parent_roles': p}
|
||||||
graph_js = json.dumps(graph, separators=(',',':'))
|
graph_js = json.dumps(graph, separators=(',',':'))
|
||||||
|
display_names = {}
|
||||||
|
for r in self.roles.flatten:
|
||||||
|
display_names[r] = self.roles.flatten[r]['display_name']
|
||||||
|
roles_js = json.dumps(display_names, separators=(',',':'))
|
||||||
form = self.temp_form.render(attributes=self.attributes.attributes, values=None)
|
form = self.temp_form.render(attributes=self.attributes.attributes, values=None)
|
||||||
roles = self.temp_roles.render(roles=self.roles.flatten, graph=self.roles.graph, graph_js=graph_js)
|
roles = self.temp_roles.render(roles=self.roles.flatten, graph=self.roles.graph, graph_js=graph_js, roles_js=roles_js)
|
||||||
return self.temp_adduser.render(form=form, roles=roles, is_admin=is_admin)
|
return self.temp_adduser.render(form=form, roles=roles, is_admin=is_admin)
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
|
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
|
||||||
<script type="text/javascript" src="/static/js/scripts.js"></script>
|
<script type="text/javascript" src="/static/js/scripts.js"></script>
|
||||||
<script type="text/javascript" src="/static/js/validator.js"></script>
|
<script type="text/javascript" src="/static/js/validator.js"></script>
|
||||||
|
<script type="text/javascript" src="/static/js/bootstrap-notify.js"></script>
|
||||||
<script type="text/javascript" src="/static/js/jquery.tablesorter.min.js"></script>
|
<script type="text/javascript" src="/static/js/jquery.tablesorter.min.js"></script>
|
||||||
<script type="text/javascript" src="/static/js/bootstrap-switch.js"></script>
|
<script type="text/javascript" src="/static/js/bootstrap-switch.js"></script>
|
||||||
|
|
||||||
|
@ -1,19 +1,32 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var roles = ${graph_js};
|
var graph = ${graph_js};
|
||||||
|
var roles = ${roles_js};
|
||||||
function enableParentRoles(roleid){
|
function enableParentRoles(roleid){
|
||||||
var parentRoles = roles[roleid]['parent_roles'];
|
var parentRoles = graph[roleid]['parent_roles'];
|
||||||
|
var DnRole = roles[roleid];
|
||||||
var len = parentRoles.length;
|
var len = parentRoles.length;
|
||||||
for (var i = 0; i < len; i++) {
|
for (var i = 0; i < len; i++) {
|
||||||
var role = parentRoles[i];
|
var role = parentRoles[i];
|
||||||
|
var DnParentRole = roles[role];
|
||||||
|
var checked = document.getElementById(role).checked;
|
||||||
$('input[name=' + role +']').bootstrapSwitch('state', true, true);
|
$('input[name=' + role +']').bootstrapSwitch('state', true, true);
|
||||||
|
if ( ! checked){
|
||||||
|
$.notify("Added Role '" + DnParentRole + "' (Parent Role of '" + DnRole +"')");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function disableSubRoles(roleid){
|
function disableSubRoles(roleid){
|
||||||
var parentRoles = roles[roleid]['sub_roles'];
|
var parentRoles = graph[roleid]['sub_roles'];
|
||||||
|
var DnRole = roles[roleid];
|
||||||
var len = parentRoles.length;
|
var len = parentRoles.length;
|
||||||
for (var i = 0; i < len; i++) {
|
for (var i = 0; i < len; i++) {
|
||||||
var role = parentRoles[i];
|
var role = parentRoles[i];
|
||||||
|
var DnParentRole = roles[role];
|
||||||
|
var checked = document.getElementById(role).checked;
|
||||||
$('input[name=' + role +']').bootstrapSwitch('state', false, true);
|
$('input[name=' + role +']').bootstrapSwitch('state', false, true);
|
||||||
|
if (checked){
|
||||||
|
$.notify("Removed Role '" + DnParentRole + "' (Sub Role of '" + DnRole +"')");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user