Merged
Conversation
|
@nafiuishaaq Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Merged
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.
Built out the RBAC layer around the existing Nest auth flow. The main policy surface is now roles.decorator.ts (line 18) and roles.guard.ts (line 34): routes can declare one or more allowed roles with OR logic, ADMIN inherits MODERATOR and USER, ownership can be allowed per-route, denied access returns clear 403 messages, and failed checks are logged for auditing. I also aligned the auth payload to the canonical userRole field in jwt-auth.middleware.ts (line 41) and expanded the enum with MODERATOR in userRole.enum.ts (line 1).
I applied the new guard to real endpoints so the pattern is live in the app: admin-only puzzle creation in puzzles-v1.controller.ts (line 27) and puzzles-v2.controller.ts (line 102), moderator/admin user listing plus ownership-aware user access in users.controller.ts (line 59), and user-level protected progress routes in progress.controller.ts (line 31). Developer docs are in RBAC.md, and I added a focused guard spec at roles.guard.spec.ts (line 1).
Closes #312