mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 09:25:45 +01:00
fix: #12389, update privilege group check
This commit is contained in:
@@ -56,7 +56,7 @@ Groups.removeEphemeralGroups = function (groups) {
|
|||||||
return groups;
|
return groups;
|
||||||
};
|
};
|
||||||
|
|
||||||
const isPrivilegeGroupRegex = /^cid:(?:\d+|admin):privileges:[\w\-:]+$/;
|
const isPrivilegeGroupRegex = /^cid:(?:-?\d+|admin):privileges:[\w\-:]+$/;
|
||||||
Groups.isPrivilegeGroup = function (groupName) {
|
Groups.isPrivilegeGroup = function (groupName) {
|
||||||
return isPrivilegeGroupRegex.test(groupName);
|
return isPrivilegeGroupRegex.test(groupName);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ function hookHandlerPromise(hook, hookObj, params) {
|
|||||||
if (hook.startsWith('filter:') && returned !== undefined) {
|
if (hook.startsWith('filter:') && returned !== undefined) {
|
||||||
_resolve(returned);
|
_resolve(returned);
|
||||||
} else if (hook.startsWith('static:') && hookObj.method.length <= 1) {
|
} else if (hook.startsWith('static:') && hookObj.method.length <= 1) {
|
||||||
// make sure it is resolved if static hook doesn't return anything and doesn't use callback
|
// make sure it is resolved if static hook doesn't use callback
|
||||||
_resolve();
|
_resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user