Created
March 9, 2023 12:32
-
-
Save sudarshansb143/e2cb10f6a10fa02b79dfb0a02be3ac8a to your computer and use it in GitHub Desktop.
Auth Middleware
This file contains hidden or 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
| private String ADMIN_ROLE = "admin" | |
| // Assuming this function will be called from each API with provided params | |
| public boolean isAccessAllowed(token, entityId, branchId, orgId, userRole){ | |
| if (token.role == ADMIN_ROLE) { | |
| return true; | |
| } else if (token.entityId == entityId && token.branchId === branchId && token.orgId === orgId && token.role == userRole ) { | |
| return true | |
| } else { | |
| return false | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment