Making permissions work in authorize page
This commit is contained in:
parent
0633311ba1
commit
6580cbf667
@ -54,16 +54,17 @@ ViewRouter.get("/auth", Stacker(GetUserMiddleware(false, true), async (req, res)
|
|||||||
let proms: PromiseLike<void>[] = [];
|
let proms: PromiseLike<void>[] = [];
|
||||||
if (scope) {
|
if (scope) {
|
||||||
for (let perm of scope.split(";")) {
|
for (let perm of scope.split(";")) {
|
||||||
proms.push(Permission.findOne({ id: Number(perm) }).then(p => {
|
proms.push(Permission.findById(perm).then(p => {
|
||||||
if (!p) return Promise.reject(new Error());
|
if (!p) return Promise.reject(new Error());
|
||||||
permissions.push(p);
|
permissions.push(p);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let err = false;
|
let err = false;
|
||||||
await Promise.all(proms).catch(err => {
|
await Promise.all(proms).catch(e => {
|
||||||
err = true;
|
err = true;
|
||||||
})
|
})
|
||||||
|
Logging.debug(err);
|
||||||
if (err) {
|
if (err) {
|
||||||
return sendError("invalid_scope")
|
return sendError("invalid_scope")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user