Node.js based forum software built for the modern web
finally closed #2887 -- added implicit privilege markers to client-side privileges table
Julian Lam9e994f3baf21
diff --git a/public/src/admin/manage/category.js b/public/src/admin/manage/category.jsindex c51dba4a01..238317144c 100644--- a/public/src/admin/manage/category.js+++ b/public/src/admin/manage/category.js@@ -203,7 +203,9 @@ define('admin/manage/category', [} else {app.alertError('[[error:invalid-data]]');}- })+ });++ Category.exposeAssumedPrivileges();};Category.refreshPrivilegeTable = function() {@@ -216,10 +218,33 @@ define('admin/manage/category', [privileges: privileges}, function(html) {$('.privilege-table-container').html(html);+ Category.exposeAssumedPrivileges();});});};+ Category.exposeAssumedPrivileges = function() {+ /*+ If registered-users has a privilege enabled, then all users and groups of that privilege+ should be assumed to have that privilege as well, even if not set in the db, so reflect+ this arrangement in the table+ */+ var privs = [];+ $('.privilege-table tr[data-group-name="registered-users"] td input[type="checkbox"]').parent().each(function(idx, el) {+ if ($(el).find('input').prop('checked')) {+ privs.push(el.getAttribute('data-privilege'));+ }+ });+ for(var x=0,numPrivs=privs.length;x<numPrivs;x++) {+ var inputs = $('.privilege-table tr[data-group-name]:not([data-group-name="registered-users"],[data-group-name="guests"]) td[data-privilege="' + privs[x] + '"] input');+ inputs.each(function(idx, el) {+ if (!el.checked) {+ el.indeterminate = true;+ }+ });+ }+ };+Category.setPrivilege = function(member, privilege, state, checkboxEl) {socket.emit('admin.categories.setPrivilege', {cid: ajaxify.variables.get('cid'),diff --git a/src/views/admin/manage/categories.tpl b/src/views/admin/manage/categories.tplindex 69526e86b4..39d2a15c9b 100644--- a/src/views/admin/manage/categories.tpl+++ b/src/views/admin/manage/categories.tpl@@ -1,7 +1,7 @@<div class="row"><div class="col-lg-9"><div class="panel panel-default">- <div class="panel-heading"><i class="fa fa-folder"></i> Categories</div>+ <div class="panel-heading"><i class="fa fa-folder"></i> Active Categories</div><div class="panel-body"><table class="table table-striped table-hover table-reordering"><thead>@@ -55,7 +55,7 @@</div><div class="panel panel-default">- <div class="panel-heading"><i class="fa fa-folder"></i> Categories</div>+ <div class="panel-heading"><i class="fa fa-folder"></i> Disabled Categories</div><div class="panel-body"><table class="table table-striped table-hover table-reordering"><thead>diff --git a/src/views/admin/partials/categories/privileges.tpl b/src/views/admin/partials/categories/privileges.tplindex b6b33ac42b..d18329753e 100644--- a/src/views/admin/partials/categories/privileges.tpl+++ b/src/views/admin/partials/categories/privileges.tpl@@ -42,4 +42,10 @@</tr><!-- END privileges.groups --></table>+ <div class="help-block">+ If the <code>registered-users</code> group is granted a specific privilege, all other groups receive an+ <strong>implicit privilege</strong>, even if they are not explicitly defined/checked. This implicit+ privilege is shown to you because all users are part of the <code>registered-users</code> user group,+ and so, privileges for additional groups need not be explicitly granted.+ </div></div>\ No newline at end of file