This commit is contained in:
Erik 2022-03-26 14:16:28 +02:00
parent 7e8ac200b2
commit 0e21cc4c20
No known key found for this signature in database
GPG Key ID: FEFF4B220DDF5589
2 changed files with 4 additions and 3 deletions

View File

@ -2,8 +2,9 @@ const Permissions = (perm) => {
return (req, res, next) => { return (req, res, next) => {
const { user: { permissions } } = req; const { user: { permissions } } = req;
if (permissions[perm]) return next(); if (permissions.admin || permissions[perm]) return next();
res.status(401).end(); req.client.logger.warn(`${req.user.tag} has insufficient permissions for ${perm}`);
return res.status(403).send('Insufficient permissions');
}; };

View File

@ -1,4 +1,4 @@
module.exports = { module.exports = {
CheckAuth: require('./Auth.js'), ...require('./Auth.js'),
Permissions: require('./Permissions.js'), Permissions: require('./Permissions.js'),
}; };