AAA
This commit is contained in:
parent
7d64d0e78a
commit
2426b77f6c
5
index.js
5
index.js
|
@ -44,10 +44,7 @@ global.comparePassword = async function(password, hash) {
|
|||
return await bcrypt.compare(password, hash);
|
||||
};
|
||||
|
||||
global.checkACL = function(req,, perm) {
|
||||
if (!req.session.user) {
|
||||
return res.status(401).render('error', { error: 'You must be logged in to access this resource.' });
|
||||
}
|
||||
global.checkACL = function(req, perm) {
|
||||
const perms = req.session.user.perms ? JSON.parse(req.session.user.perms) : [];
|
||||
if (perms.includes('*') || perms.includes(perm)) {
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue