Skip to content

Comments

feat(rbac): implement hierarchical permission-based RBAC with dynamic role assignment and audit logging (#50)#129

Merged
llinsss merged 1 commit intoDogStark:mainfrom
devxsameer:feat/rbac-authorization-system
Feb 22, 2026
Merged

feat(rbac): implement hierarchical permission-based RBAC with dynamic role assignment and audit logging (#50)#129
llinsss merged 1 commit intoDogStark:mainfrom
devxsameer:feat/rbac-authorization-system

Conversation

@devxsameer
Copy link
Contributor

Description

This PR implements a hierarchical, permission-based Role-Based Access Control (RBAC) system aligned with Issue #50 requirements. It introduces the VetStaff role, expands the permission model, enforces permission-first route guards, enables dynamic role assignment, and integrates a complete audit trail for role changes. The system ensures secure, extensible, and maintainable authorization across the backend.


Related Issues

Closes #50


Changes Made

  • Added VetStaff role to the system
  • Added missing permissions (SHARE_RECORDS, PRESCRIBE, READ_ASSIGNED_PETS, UPDATE_APPOINTMENTS, CREATE_NOTES)
  • Implemented recursive role-permission resolution for hierarchy support
  • Refactored RolesGuard to enforce permission-first authorization
  • Strongly typed @Permissions() decorator using Permission[]
  • Added admin-protected endpoints:
    • POST /roles/assign
    • POST /roles/remove
    • GET /roles/user/:userId
  • Implemented soft role removal (isActive = false)
  • Integrated RoleAuditLog for role assignment and removal
  • Updated RolesPermissionsSeeder to align with required permission mappings
  • Ensured active role filtering during permission resolution

@llinsss llinsss merged commit 379ced4 into DogStark:main Feb 22, 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.

Role-Based Access Control (RBAC)

2 participants