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>[] = [];
|
||||
if (scope) {
|
||||
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());
|
||||
permissions.push(p);
|
||||
}));
|
||||
}
|
||||
}
|
||||
let err = false;
|
||||
await Promise.all(proms).catch(err => {
|
||||
await Promise.all(proms).catch(e => {
|
||||
err = true;
|
||||
})
|
||||
Logging.debug(err);
|
||||
if (err) {
|
||||
return sendError("invalid_scope")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user