21 lines
1.0 KiB
Plaintext
21 lines
1.0 KiB
Plaintext
---
|
|
description: Super administrators inherit all administrator page and API access
|
|
globs: backend/src/**/*.ts,prediqo_web/src/shared/auth/**/*.ts,prediqo_web/src/app/router/**/*.tsx,prediqo_mobile/lib/features/auth/**/*.dart
|
|
alwaysApply: false
|
|
---
|
|
|
|
# Admin access — super_admin parity
|
|
|
|
`super_admin` must have access to **every** page and API route available to `admin`.
|
|
|
|
## Rules
|
|
|
|
- Use `hasAdminAccess()` (`backend/src/utils/roleAccess.ts` or `prediqo_web/src/shared/auth/roleAccess.ts`) instead of `role === 'admin'`.
|
|
- Route guards: `requireRoles('admin')` already treats `super_admin` as admin; do not duplicate stricter checks downstream.
|
|
- Staff tools (support, FAQ admin): include `super_admin` in staff role checks (`hasStaffAccess` / `isStaffRole`).
|
|
- UI: derive visibility from `isAdmin` (web) or `isAdmin` getter (mobile), never from `role == 'admin'` alone.
|
|
|
|
## JWT note
|
|
|
|
`primaryRole` for users with both roles is `super_admin`. Code that only checks `req.user.role === 'admin'` will wrongly deny super admins.
|