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);
|
return await bcrypt.compare(password, hash);
|
||||||
};
|
};
|
||||||
|
|
||||||
global.checkACL = function(req,, perm) {
|
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.' });
|
|
||||||
}
|
|
||||||
const perms = req.session.user.perms ? JSON.parse(req.session.user.perms) : [];
|
const perms = req.session.user.perms ? JSON.parse(req.session.user.perms) : [];
|
||||||
if (perms.includes('*') || perms.includes(perm)) {
|
if (perms.includes('*') || perms.includes(perm)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -30,4 +30,4 @@ console.log('Local IP address:', localIP);
|
||||||
uhppoted.setListener(ctx, 423163924, localIP, 60001, 1);
|
uhppoted.setListener(ctx, 423163924, localIP, 60001, 1);
|
||||||
uhppoted.listen(ctx, (msg) => {
|
uhppoted.listen(ctx, (msg) => {
|
||||||
console.log(msg)
|
console.log(msg)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue