feat(acp): admin tags privilege

v1.18.x
Julian Lam 4 years ago
parent d90aa95808
commit 223f0a5515

@ -41,6 +41,7 @@
"admin-users": "Users",
"admin-admins-mods": "Admins & Mods",
"admin-groups": "Groups",
"admin-tags": "Tags",
"admin-settings": "Settings",
"alert.confirm-moderate": "<strong>Are you sure you wish to grant the moderation privilege to this user group?</strong> This group is public, and any users can join at will.",

@ -46,6 +46,8 @@ adminController.routeIndex = async (req, res) => {
return helpers.redirect(res, 'admin/manage/groups');
} else if (privilegeSet['admin:admins-mods']) {
return helpers.redirect(res, 'admin/manage/admins-mods');
} else if (privilegeSet['admin:tags']) {
return helpers.redirect(res, 'admin/manage/tags');
} else if (privilegeSet['admin:settings']) {
return helpers.redirect(res, 'admin/settings/general');
}

@ -73,7 +73,7 @@ middleware.renderHeader = async (req, res, data) => {
version: version,
latestVersion: results.latestVersion,
upgradeAvailable: results.latestVersion && semver.gt(results.latestVersion, version),
showManageMenu: results.privileges.superadmin || ['categories', 'privileges', 'users', 'admins-mods', 'groups', 'settings'].some(priv => results.privileges[`admin:${priv}`]),
showManageMenu: results.privileges.superadmin || ['categories', 'privileges', 'users', 'admins-mods', 'groups', 'tags', 'settings'].some(priv => results.privileges[`admin:${priv}`]),
};
templateValues.template = { name: res.locals.template };

@ -19,6 +19,7 @@ module.exports = function (privileges) {
{ name: '[[admin/manage/privileges:admin-admins-mods]]' },
{ name: '[[admin/manage/privileges:admin-users]]' },
{ name: '[[admin/manage/privileges:admin-groups]]' },
{ name: '[[admin/manage/privileges:admin-tags]]' },
{ name: '[[admin/manage/privileges:admin-settings]]' },
];
@ -29,6 +30,7 @@ module.exports = function (privileges) {
'admin:admins-mods',
'admin:users',
'admin:groups',
'admin:tags',
'admin:settings',
];
@ -42,6 +44,8 @@ module.exports = function (privileges) {
'manage/admins-mods': 'admin:admins-mods',
'manage/users': 'admin:users',
'manage/groups': 'admin:groups',
'manage/tags': 'admin:tags',
'settings/tags': 'admin:tags',
'extend/plugins': 'admin:settings',
'extend/widgets': 'admin:settings',
'extend/rewards': 'admin:settings',
@ -89,6 +93,11 @@ module.exports = function (privileges) {
'admin.user.createUser': 'admin:users',
'admin.user.invite': 'admin:users',
'admin.tags.create': 'admin:tags',
'admin.tags.update': 'admin:tags',
'admin.tags.rename': 'admin:tags',
'admin.tags.deleteTags': 'admin:tags',
'admin.getSearchDict': 'admin:settings',
'admin.config.setMultiple': 'admin:settings',
'admin.config.remove': 'admin:settings',

@ -20,9 +20,9 @@
{{{ if user.privileges.admin:users }}}<li><a href="{relative_path}/admin/manage/users">[[admin/menu:manage/users]]</a></li>{{{ end }}}
{{{ if user.privileges.admin:groups }}}<li><a href="{relative_path}/admin/manage/groups">[[admin/menu:manage/groups]]</a></li>{{{ end }}}
{{{ if user.privileges.admin:admins-mods }}}<li><a href="{relative_path}/admin/manage/admins-mods">[[admin/menu:manage/admins-mods]]</a></li>{{{ end }}}
{{{ if user.privileges.admin:tags }}}<li><a href="{relative_path}/admin/manage/tags">[[admin/menu:manage/tags]]</a></li>{{{ end }}}
{{{ if user.privileges.superadmin }}}
<li><a href="{relative_path}/admin/manage/registration">[[admin/menu:manage/registration]]</a></li>
<li><a href="{relative_path}/admin/manage/tags">[[admin/menu:manage/tags]]</a></li>
<li><a href="{relative_path}/admin/manage/uploads">[[admin/menu:manage/uploads]]</a></li>
<li><a href="{relative_path}/admin/manage/digest">[[admin/menu:manage/digest]]</a></li>
@ -191,9 +191,9 @@
{{{ if user.privileges.admin:users }}}<li><a id="manage-users" href="{relative_path}/admin/manage/users">[[admin/menu:manage/users]]</a></li>{{{ end }}}
{{{ if user.privileges.admin:groups }}}<li><a href="{relative_path}/admin/manage/groups">[[admin/menu:manage/groups]]</a></li>{{{ end }}}
{{{ if user.privileges.admin:admins-mods }}}<li><a href="{relative_path}/admin/manage/admins-mods">[[admin/menu:manage/admins-mods]]</a></li>{{{ end }}}
{{{ if user.privileges.admin:tags }}}<li><a href="{relative_path}/admin/manage/tags">[[admin/menu:manage/tags]]</a></li>{{{ end }}}
{{{ if user.privileges.superadmin }}}
<li><a href="{relative_path}/admin/manage/registration">[[admin/menu:manage/registration]]</a></li>
<li><a href="{relative_path}/admin/manage/tags">[[admin/menu:manage/tags]]</a></li>
<li><a href="{relative_path}/admin/manage/uploads">[[admin/menu:manage/uploads]]</a></li>
<li><a href="{relative_path}/admin/manage/digest">[[admin/menu:manage/digest]]</a></li>
<li role="separator" class="divider"></li>

Loading…
Cancel
Save