mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
Chat with privileged (#12092)
* Update headers.js Fixes X-Upstream-Hostname header for os hostnames with invalid characters * Added missing period in allowed hostname chars Allowed hostname chars should include A-Za-z0-9-. based on https://man7.org/linux/man-pages/man7/hostname.7.html * feat: add chat:privileged global privilege to only allow chatting with privileged users * test: fix priv test * test: one more fix --------- Co-authored-by: chadjw <chad.warner@gmail.com>
This commit is contained in:
committed by
GitHub
parent
47910d708d
commit
b398321a5e
@@ -155,8 +155,8 @@ module.exports = function (middleware) {
|
||||
});
|
||||
|
||||
middleware.canChat = helpers.try(async (req, res, next) => {
|
||||
const canChat = await privileges.global.can('chat', req.uid);
|
||||
if (canChat) {
|
||||
const canChat = await privileges.global.can(['chat', 'chat:privileged'], req.uid);
|
||||
if (canChat.includes(true)) {
|
||||
return next();
|
||||
}
|
||||
controllers.helpers.notAllowed(req, res);
|
||||
|
||||
Reference in New Issue
Block a user