Skip to content

fix(rbac): replace dashboard super-admin-only access with dashboard.view permission - #424

Merged
YuZhiYuanDev merged 1 commit into
mainfrom
fix/dashboard-rbac-permission
Oct 11, 2026
Merged

YuZhiYuanDev merged 1 commit into
mainfrom
fix/dashboard-rbac-permission

Conversation

@hashbk

@hashbk hashbk commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add a dedicated dashboard.view permission code to the RBAC catalog
  • Replace @RequireSuperAdmin() with @RequirePermission('dashboard.view') on the dashboard controller
  • Update the RBAC spec test to verify the new permission requirement

Context

The dashboard was originally restricted to super administrators because the old dashboard displayed sensitive connection logs. After the dashboard refactor the content was streamlined to overview statistics only, but the permission was never updated. This means that even roles with all permissions (e.g. System Administrator) cannot access the dashboard — only the super admin can.

This PR introduces a dashboard.view permission so that any role granted this permission can access the dashboard.

Closes #415

Summary by CodeRabbit

  • Access Control
    • Dashboard routes now require the dashboard-view permission rather than super-administrator access. This permission is available for assignment across the system.

…iew permission

The dashboard was restricted to super administrators because the old
dashboard displayed sensitive connection logs. After the dashboard
refactor the content was streamlined to overview statistics only, but
the permission was never updated. Add a dedicated 'dashboard.view'
permission code to the RBAC catalog and replace @RequireSuperAdmin()
with @RequirePermission('dashboard.view') so that roles with this
permission can access the dashboard.

Closes #415
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0c8511fb-7bee-4acb-8aa9-5af7650ac76f

📥 Commits

Reviewing files that changed from the base of the PR and between 0f7673a and a128e10.


📒 Files selected for processing (3)
  • src/modules/dashboard/dashboard.controller.ts
  • src/modules/rbac/constants/permission-catalog.ts
  • src/modules/rbac/rbac-authorization.service.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.



📝 Walkthrough

Walkthrough

The dashboard controller now requires the assignable dashboard.view permission instead of super-administrator metadata. The authorization test checks the updated permission metadata.

Changes

Dashboard authorization

Layer / File(s) Summary
Register and apply dashboard-view permission
src/modules/rbac/constants/permission-catalog.ts, src/modules/dashboard/dashboard.controller.ts, src/modules/rbac/rbac-authorization.service.spec.ts
PermissionCode and PERMISSION_CATALOG add the assignable dashboard.view permission. DashboardController uses @RequirePermission('dashboard.view'), and the test checks that the controller has no super-administrator metadata and requires this permission.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium


Merge Risk: ⚪ Minimal · up to a128e

A super administrator can explicitly grant dashboard access to roles. The dashboard endpoints return overview and trend aggregates rather than per-connection logs.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: replacing dashboard super-admin-only access with the dashboard.view permission.
Linked Issues check Passed Issue #415 reports that non-super-admin roles could not open the dashboard. DashboardController now requires dashboard.view. PERMISSION_CATALOG defines dashboard.view as an assignable global p…
Out of Scope Changes check Passed The changes are limited to the dashboard authorization decorator, the RBAC permission type and catalog entry, and the related RBAC spec expectation. These changes directly implement issue #415 and the…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR


🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@YuZhiYuanDev
YuZhiYuanDev merged commit 630cdba into main Oct 11, 2026
12 checks passed
@YuZhiYuanDev
YuZhiYuanDev deleted the fix/dashboard-rbac-permission branch October 11, 2026 07:29
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.

Even with latest update, I have problem with admin-superadmin roles

2 participants