[enh] Replace permissions by groups

This commit is contained in:
ljf 2019-10-20 01:38:58 +02:00
parent de5d61d64e
commit 38775a42a7
5 changed files with 13 additions and 18 deletions

View file

@ -664,7 +664,7 @@ input[type='radio'].nice-radio {
/** Permissions View **/
#view-permissions {
#view-groups {
.panel-heading a {
text-decoration: none;
&.group-delete {

View file

@ -6,10 +6,11 @@
var PASSWORD_MIN_LENGTH = 4;
/**
* Permissions
* Groups and permissions
*
*/
function updateGroup(model, params) {
var type = params.type;
var operation = params.operation;
@ -51,7 +52,7 @@
model.groups[group].membersInv.sort();
}
var rendered = c.render('views/user/user_permission.ms', model);
var rendered = c.render('views/user/group_list.ms', model);
rendered.swap(function () {
jQuery(".group-update").on('click', function (e) {
updateGroup(model, jQuery(this)[0].dataset);
@ -64,8 +65,7 @@
});
});
}
this.displayPermission = // List groups and permissions
app.get('#/permissions', function (c) {
app.get('#/groups', function (c) {
c.api('/users/groups?full&include_primary_groups', function(data_groups) {
c.api('/users', function(data_users) {
c.api('/users/permissions?short', function(data_permissions) {
@ -109,11 +109,6 @@
});
});
/**
* Groups
*
*/
// Create a new group
app.get('#/groups/create', function (c) {
c.view('user/group_create', {});
@ -122,7 +117,7 @@
app.post('#/groups/create', function (c) {
c.params['groupname'] = c.params['groupname'].replace(' ', '_').toLowerCase();
c.api('/users/groups', function(data) {
c.redirect('#/permissions');
c.redirect('#/groups');
}, 'POST', c.params.toHash());
});
@ -139,12 +134,12 @@
confirmModalContent,
function(){
c.api('/users/groups/'+ c.params['group'], function(data) {
c.redirect('#/permissions');
c.redirect('#/groups');
}, 'DELETE', params);
},
function(){
//store.clear('slide');
c.redirect('#/permissions');
c.redirect('#/groups');
}
);

View file

@ -2,8 +2,8 @@
<a href="#/" ><i class="fa-home"></i><span class="sr-only">{{t 'home'}}</span></a>
<a href="#/users" class="visible-xs">&hellip;</a>
<a href="#/users" class="hidden-xs">{{t 'users'}}</a>
<a href="#/permissions" class="visible-xs">&hellip;</a>
<a href="#/permissions" class="hidden-xs">{{t 'group_permissions'}}</a>
<a href="#/groups" class="visible-xs">&hellip;</a>
<a href="#/groups" class="hidden-xs">{{t 'group_permissions'}}</a>
<a href="#/groups/create">{{t 'group_new'}}</a>
</div>

View file

@ -1,7 +1,7 @@
<div class="btn-breadcrumb">
<a href="#/"><i class="fa-home"></i><span class="sr-only">{{t 'home'}}</span></a>
<a href="#/users">{{t 'users'}}</a>
<a href="#/permissions">{{t 'group_permissions'}}</a>
<a href="#/groups">{{t 'group_permissions'}}</a>
</div>
<div class="actions-group">
@ -41,7 +41,7 @@
</div>
{{/if}}
{{/inline}}
<div id="view-permissions">
<div id="view-groups">
{{#each groups}}
{{#unless primary}}
<div class="panel panel-default">

View file

@ -4,7 +4,7 @@
</div>
<div class="actions-group">
<a href="#/permissions" class="btn btn-info">
<a href="#/groups" class="btn btn-info">
<span class="fa-key-modern"></span> {{t 'group_manage_permissions'}}
</a>
<a role="button" href="#/users/create" class="btn btn-success slide">