feat: headers for global privs #9717 (#9762)

* feat: headers for global privs #9717

* fix: don't spoil headers to adminPrivs

Co-authored-by: Julian Lam <julian@nodebb.org>
isekai-main
gasoved 3 years ago committed by GitHub
parent ee02771959
commit 84ff1152f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -183,7 +183,8 @@ define('admin/manage/privileges', [
api.get(`/categories/${cid}/privileges`, {}).then((privileges) => {
ajaxify.data.privileges = { ...ajaxify.data.privileges, ...privileges };
const tpl = parseInt(cid, 10) ? 'admin/partials/privileges/category' : 'admin/partials/privileges/global';
app.parseAndTranslate(tpl, { privileges }).then((html) => {
const isAdminPriv = ajaxify.currentPage.endsWith('admin/manage/privileges/admin');
app.parseAndTranslate(tpl, { privileges, isAdminPriv }).then((html) => {
// Get currently selected filters
const btnIndices = $('.privilege-filters button.btn-warning').map((idx, el) => $(el).index()).get();
$('.privilege-table-container').html(html);

@ -44,8 +44,9 @@ privilegesController.get = async function (req, res) {
res.render('admin/manage/privileges', {
privileges: privilegesData,
categories: categoriesData,
selectedCategory: selectedCategory,
cid: cid,
group: group,
selectedCategory,
cid,
group,
isAdminPriv,
});
};

@ -16,8 +16,8 @@ privsGlobal.privilegeLabels = [
{ name: '[[admin/manage/privileges:upload-images]]' },
{ name: '[[admin/manage/privileges:upload-files]]' },
{ name: '[[admin/manage/privileges:signature]]' },
{ name: '[[admin/manage/privileges:ban]]' },
{ name: '[[admin/manage/privileges:invite]]' },
{ name: '[[admin/manage/privileges:allow-group-creation]]' },
{ name: '[[admin/manage/privileges:search-content]]' },
{ name: '[[admin/manage/privileges:search-users]]' },
{ name: '[[admin/manage/privileges:search-tags]]' },
@ -25,7 +25,7 @@ privsGlobal.privilegeLabels = [
{ name: '[[admin/manage/privileges:view-tags]]' },
{ name: '[[admin/manage/privileges:view-groups]]' },
{ name: '[[admin/manage/privileges:allow-local-login]]' },
{ name: '[[admin/manage/privileges:allow-group-creation]]' },
{ name: '[[admin/manage/privileges:ban]]' },
{ name: '[[admin/manage/privileges:view-users-info]]' },
];
@ -34,8 +34,8 @@ privsGlobal.userPrivilegeList = [
'upload:post:image',
'upload:post:file',
'signature',
'ban',
'invite',
'group:create',
'search:content',
'search:users',
'search:tags',
@ -43,7 +43,7 @@ privsGlobal.userPrivilegeList = [
'view:tags',
'view:groups',
'local:login',
'group:create',
'ban',
'view:users:info',
];

@ -1,6 +1,20 @@
<label>[[admin/manage/privileges:group-privileges]]</label>
<table class="table table-striped privilege-table">
<thead>
{{{ if !isAdminPriv }}}
<tr class="privilege-table-header">
<th colspan="3"></th>
<th class="arrowed" colspan="6">
[[admin/manage/categories:privileges.section-posting]]
</th>
<th class="arrowed" colspan="7">
[[admin/manage/categories:privileges.section-viewing]]
</th>
<th class="arrowed" colspan="2">
[[admin/manage/categories:privileges.section-moderation]]
</th>
</tr><tr><!-- zebrastripe reset --></tr>
{{{ end }}}
<tr>
<th colspan="2">[[admin/manage/categories:privileges.section-group]]</th>
<th class="text-center">[[admin/manage/privileges:select-clear-all]]</th>

Loading…
Cancel
Save