Skip to content

Feat/role#361

Merged
A6dulmalik merged 3 commits intoMindBlockLabs:mainfrom
nafiuishaaq:feat/role
Mar 26, 2026
Merged

Feat/role#361
A6dulmalik merged 3 commits intoMindBlockLabs:mainfrom
nafiuishaaq:feat/role

Conversation

@nafiuishaaq
Copy link
Copy Markdown
Contributor

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

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 26, 2026

@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! 🚀

Learn more about application limits

@A6dulmalik A6dulmalik merged commit c821a50 into MindBlockLabs:main Mar 26, 2026
3 of 6 checks passed
@A6dulmalik A6dulmalik mentioned this pull request Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Role-Based Access Control (RBAC) Middleware

2 participants