mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 23:15:48 +01:00
9622 (#9625)
* fix: #9622 dont allow regular user to remove system tags * refactor: add guest/spider check to isPrivileged string/trim tag
This commit is contained in:
committed by
GitHub
parent
0d975bc4fb
commit
1bf263c4a2
@@ -32,7 +32,7 @@ module.exports = function (SocketTopics) {
|
||||
|
||||
const systemTags = (meta.config.systemTags || '').split(',');
|
||||
const isPrivileged = await user.isPrivileged(socket.uid);
|
||||
return isPrivileged || !systemTags.includes(data.tag);
|
||||
return isPrivileged || !systemTags.includes(String(data.tag).trim());
|
||||
};
|
||||
|
||||
SocketTopics.autocompleteTags = async function (socket, data) {
|
||||
|
||||
@@ -159,6 +159,9 @@ User.getPrivileges = async function (uid) {
|
||||
};
|
||||
|
||||
User.isPrivileged = async function (uid) {
|
||||
if (!(parseInt(uid, 10) > 0)) {
|
||||
return false;
|
||||
}
|
||||
const results = await User.getPrivileges(uid);
|
||||
return results ? (results.isAdmin || results.isGlobalModerator || results.isModeratorOfAnyCategory) : false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user