feat(middlewares): add access to admin services for super-admin
This commit is contained in:
parent
2f5720f2b3
commit
ad4b43e56e
@ -9,13 +9,13 @@ export default async function ruleHandler(req: Request, response: Response, next
|
||||
response.status(HttpCodes.UNAUTHORIZED).send("Missing rules in JWT");
|
||||
return;
|
||||
}
|
||||
// const namespace = req.path && req.path.split("/")[3];
|
||||
// const role = req.body.user.role;
|
||||
const namespace = req.path && req.path.split("/")[3];
|
||||
const role = req.body.user.role;
|
||||
|
||||
// if (namespace != "notary" && role != namespace) {
|
||||
// response.status(HttpCodes.UNAUTHORIZED).send("Unauthorized with this role");
|
||||
// return;
|
||||
// }
|
||||
if (namespace != "notary" && role != namespace && role != "super-admin") {
|
||||
response.status(HttpCodes.UNAUTHORIZED).send("Unauthorized with this role");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!rules.includes(req.method + " " + service)) {
|
||||
response.status(HttpCodes.UNAUTHORIZED).send("Unauthorized with those rules");
|
||||
|
Loading…
x
Reference in New Issue
Block a user