feat(admin): implement CRUD endpoints for roles and permissions#30
Merged
Somilg11 merged 2 commits intoOPCODE-Open-Spring-Fest:mainfrom Oct 15, 2025
Merged
feat(admin): implement CRUD endpoints for roles and permissions#30Somilg11 merged 2 commits intoOPCODE-Open-Spring-Fest:mainfrom
Somilg11 merged 2 commits intoOPCODE-Open-Spring-Fest:mainfrom
Conversation
Collaborator
|
Thank you for raising a PR. Due to the previous branch merge, there may be some conflicts; do check them out and resolve them. Thanks again for your contribution. |
Contributor
Author
|
Done sir |
Member
|
@Somilg11 there is a mismatch in the difficulty level of this PR (medium) and the difficulty level of the corresponding issue (hard), so @indrasuthar07 will only receive points according to the PR's difficulty (medium). Is this intentional? If not, do let me know and I will update the score accordingly. |
Collaborator
|
Do update the score, according to type hard |
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.
Implemented a complete set of API endpoints for managing Roles and Permissions, restricted to Admin users.
This includes:
1.Roles CRUD (/api/roles)
2.Permissions CRUD (/api/permissions)
3.Assigning permissions to roles (/api/roles/:roleId/permissions)
All routes are protected by auth and RBAC middleware, accessible only to users with the Admin role.
Testing Done:
-Tested all endpoints locally using Postman with a valid Admin JWT token.
-Verified responses in Postman: creation of Role, creation of Permission, assigning Permission to Role, and fetching all roles.
Verified database updates in MongoDB Compass:
-roles collection contains the role(s) with assigned permissions.
-permissions collection contains all permissions created.
Screenshots:



Issues
closes #15
Checklist