Last active
August 29, 2023 13:58
-
-
Save francium-lupe/0143364c0d75418aa6d8385ef6ac7194 to your computer and use it in GitHub Desktop.
requiredRoles Mapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (endpoint && endpoint in requiredRoles) { | |
if (!roles.find(role => requiredRoles[endpoint].has(role))) { | |
throw new BadRequest( | |
`User not authorized for action ${actionName}, has roles "${roles}"` | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment