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");
|
response.status(HttpCodes.UNAUTHORIZED).send("Missing rules in JWT");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// const namespace = req.path && req.path.split("/")[3];
|
const namespace = req.path && req.path.split("/")[3];
|
||||||
// const role = req.body.user.role;
|
const role = req.body.user.role;
|
||||||
|
|
||||||
// if (namespace != "notary" && role != namespace) {
|
if (namespace != "notary" && role != namespace && role != "super-admin") {
|
||||||
// response.status(HttpCodes.UNAUTHORIZED).send("Unauthorized with this role");
|
response.status(HttpCodes.UNAUTHORIZED).send("Unauthorized with this role");
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (!rules.includes(req.method + " " + service)) {
|
if (!rules.includes(req.method + " " + service)) {
|
||||||
response.status(HttpCodes.UNAUTHORIZED).send("Unauthorized with those rules");
|
response.status(HttpCodes.UNAUTHORIZED).send("Unauthorized with those rules");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user