mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-16 05:20:24 +01:00
fix: admin privilege overrides only apply to local categories
This commit is contained in:
@@ -96,14 +96,16 @@ privsCategories.get = async function (cid, uid) {
|
||||
'topics:tag', 'read', 'posts:view_deleted',
|
||||
];
|
||||
|
||||
const [userPrivileges, isAdministrator, isModerator] = await Promise.all([
|
||||
let [userPrivileges, isAdministrator, isModerator] = await Promise.all([
|
||||
helpers.isAllowedTo(privs, uid, cid),
|
||||
user.isAdministrator(uid),
|
||||
user.isModerator(uid, cid),
|
||||
]);
|
||||
|
||||
const combined = userPrivileges.map(allowed => allowed || isAdministrator);
|
||||
const privData = _.zipObject(privs, combined);
|
||||
if (utils.isNumber(cid)) {
|
||||
userPrivileges = userPrivileges.map(allowed => allowed || isAdministrator);
|
||||
}
|
||||
const privData = _.zipObject(privs, userPrivileges);
|
||||
const isAdminOrMod = isAdministrator || isModerator;
|
||||
|
||||
return await plugins.hooks.fire('filter:privileges.categories.get', {
|
||||
|
||||
Reference in New Issue
Block a user