a
This commit is contained in:
parent
7e8ac200b2
commit
0e21cc4c20
@ -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');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
CheckAuth: require('./Auth.js'),
|
...require('./Auth.js'),
|
||||||
Permissions: require('./Permissions.js'),
|
Permissions: require('./Permissions.js'),
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user