Skip to content

feat(auth): add Monitoring role with read access to financial dashboard#3727

Open
TaprootFreak wants to merge 1 commit into
developfrom
feat/monitoring-role
Open

feat(auth): add Monitoring role with read access to financial dashboard#3727
TaprootFreak wants to merge 1 commit into
developfrom
feat/monitoring-role

Conversation

@TaprootFreak
Copy link
Copy Markdown
Collaborator

Summary

  • Adds a new MONITORING user role with read-only access to the financial dashboard endpoints.
  • Hierarchy: ADMINCOMPLIANCEMONITORING — all three roles are explicitly listed on the affected guards so each can hit the endpoints without changing the existing additionalRoles hierarchy map.
  • Extends RoleGuard to accept multiple entry roles (variadic, backward-compatible — existing single-arg call sites are unaffected).

Changes

  • src/shared/auth/user-role.enum.ts: add MONITORING = 'Monitoring' (positioned after MARKETING, before service / external roles).
  • src/shared/auth/role.guard.ts: make RoleGuard(...entryRoles) variadic; canActivate returns true if the request role matches (or is in the additionalRoles of) any of the supplied entry roles.
  • src/subdomains/supporting/dashboard/dashboard-financial.controller.ts: widen guards on all four endpoints (GET /dashboard/financial/log, /latest, /changes/latest, /ref-recipients, /changes) from RoleGuard(ADMIN) to RoleGuard(ADMIN, COMPLIANCE, MONITORING).

Test plan

  • npm run lint
  • npm run format (no diff)
  • npm run type-check
  • npm run build
  • npm test (938 passed, 106 skipped — unchanged baseline)
  • Manual: assign a user the Monitoring role and verify they can hit the five financial dashboard endpoints; verify they cannot hit other admin-only endpoints.

Migration notes

None — additive enum value + guard widening only. No DB / schema changes.

Coordination

Touches a different file than the in-flight PR #3725 (perf/dashboard-financial-log-optimization modifies the service, this PR modifies the controller + auth) — no merge conflicts expected.

@TaprootFreak TaprootFreak marked this pull request as ready for review May 20, 2026 09:21
@TaprootFreak TaprootFreak requested a review from davidleomay as a code owner May 20, 2026 09:21
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add [UserRole.MONITORING]: [UserRole.ADMIN, UserRole.SUPER_ADMIN], to additionalRoles -> can remove admin on dashboard controller endpoints

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.

2 participants