Feature/rbac auth#1446
Open
jeba57 wants to merge 2 commits into
Open
Conversation
Author
|
Hi, I have implemented RBAC so that admin users can access protected routes while staff users are restricted. Kindly review the changes. Thank you! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #457
Description
This PR introduces role-based access control (RBAC) to the existing authentication system.
Previously, any logged-in user (ADMIN or STAFF) could access important actions like creating data.
Now, we have added a role check:
This ensures that only ADMIN users can perform sensitive operations.
Steps to Test
Login using valid credentials to obtain JWT token
Use the token in Postman (Authorization → Bearer Token)
Test protected endpoint:
POST
/api/client/createTest with different roles:
Screenshots (if applicable)
Scope Note
This PR focuses on implementing role-based authorization (RBAC) using the existing authentication system.
User registration, login, and logout functionalities are already present in the project. Enhancements to those can be handled in a separate PR if needed.
Checklist
✔ I have tested these changes
✘ I have updated the relevant documentation (not done – this PR focuses on RBAC only)
✔ I have commented my code, particularly in hard-to-understand areas
✔ I have made corresponding changes to the codebase
✔ My changes generate no new warnings or errors
✔ The title of my pull request is clear and descriptive