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:
Barış Soner Uşaklı
2023-10-17 13:19:25 -04:00
committed by GitHub
parent 47910d708d
commit b398321a5e
13 changed files with 50 additions and 29 deletions

View File

@@ -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);