mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
fix: privileges added by plugins (#9802)
* fix: privileges added by plugins when copying a categories privileges, privileges added by plugins will be copied as well when purging a category privileges added by plugins will be purged as well show plugin privileges in privileges.<categories/admin/global>.get show plugin privileges in privileges.<categories/admin/global>.userPrivileges show plugin privileges in privileges.<categories/admin/global>.groupPrivileges * fix: typo
This commit is contained in:
committed by
GitHub
parent
506035b5f7
commit
3ecbb624d8
@@ -71,16 +71,19 @@ categoriesAPI.setPrivilege = async (caller, data) => {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
}
|
||||
if (parseInt(data.cid, 10) === 0) {
|
||||
const adminPrivs = privs.filter(priv => privileges.admin.privilegeList.includes(priv));
|
||||
const globalPrivs = privs.filter(priv => privileges.global.privilegeList.includes(priv));
|
||||
const adminPrivList = await privileges.admin.getPrivilegeList();
|
||||
const adminPrivs = privs.filter(priv => adminPrivList.includes(priv));
|
||||
if (adminPrivs.length) {
|
||||
await privileges.admin[type](adminPrivs, data.member);
|
||||
}
|
||||
const globalPrivList = await privileges.global.getPrivilegeList();
|
||||
const globalPrivs = privs.filter(priv => globalPrivList.includes(priv));
|
||||
if (globalPrivs.length) {
|
||||
await privileges.global[type](globalPrivs, data.member);
|
||||
}
|
||||
} else {
|
||||
const categoryPrivs = privs.filter(priv => privileges.categories.privilegeList.includes(priv));
|
||||
const categoryPrivList = await privileges.categories.getPrivilegeList();
|
||||
const categoryPrivs = privs.filter(priv => categoryPrivList.includes(priv));
|
||||
await privileges.categories[type](categoryPrivs, data.cid, data.member);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user