Align RBAC API contract

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Jelaletdin12andCopilot App committed 2026-09-28 13:14:11 +05:00
1 parent 8dc61d7786
commit 4c4d037a1e
39 files changed
+410 -1071

No files matched your search

+9 -4
View File
@@ -25,6 +25,7 @@ A full-featured internal banking administration panel built with **React 19 + Vi
7. [Feature Modules](#feature-modules)
8. [Shared Components](#shared-components)
9. [Route Map](#route-map)
- [RBAC API contract](#rbac-api-contract)
10. [Development Standards](#development-standards)
11. [Known Issues & Gaps](#known-issues--gaps)
@@ -558,9 +559,6 @@ All authenticated routes are nested under `DashboardLayout`. The full list:
/settings/users/roles/:id/edit
/settings/users/permissions
/settings/users/permissions/create
/settings/users/permissions/:id
/settings/users/permissions/:id/edit
/settings/loan/loan-types
/settings/loan/loan-types/create
@@ -595,6 +593,14 @@ All authenticated routes are nested under `DashboardLayout`. The full list:
* → NotFoundPage
```
### RBAC API contract
- `/profile` returns `role: { id, code, name, scope, isSuper }`, permissions as `{ code, name }[]`, and no `guardName` or `modules`.
- Permission codes are module-level (`users`, `roles`, `branches`, `provinces`, `activity-logs`, `backups`, `currencies`, `payment-settings`, `cards`, `loans`, `dashboard`); a code grants both read and write access. The permissions screen is a read-only catalog from `GET /permissions`.
- Roles contain `scope`, `isSuper`, `isSystem`, permission codes, and user count. Creation sends `{ code, name, scope, permissions }`; updates send `{ name, scope, permissions }`.
- System roles cannot be deleted or have their scope changed. Role codes are immutable after creation.
- User create/update sends the role code and `roleId` when available; role reassignment uses `PUT /users/:id/role` with `{ roleId }`.
---
## Development Standards
@@ -640,7 +646,6 @@ These items exist in the sidebar nav or codebase but are **not yet implemented**
| **`/settings/language/resources`** | ❌ No route or page | Same as above |
| **`/logs`** | ❌ No route or page | Sidebar entry exists |
| **`client.ts` uses `any`** | ⚠️ | `failedQueue: any[]` violates the no-`any` rule — should be typed |
| **`authStore` role type** | ⚠️ | `role: 'admin' \| 'manager' \| 'viewer'` — actual role enforcement (RBAC) not wired to UI |
| **`DashboardLayout` sidebar strings** | ⚠️ | Nav item titles use `t("English", "Fallback")` instead of proper i18n keys — inconsistent with the project standard |
| **`AuthLayout`** | ❌ Missing | No dedicated layout for the login page; it renders without a wrapper layout |
| **Mock data** | ⚠️ | All API functions currently return **mock in-memory data**. When connecting a real backend, replace the functions in `[feature]Api.ts` with real `apiClient.get/post/put/delete()` calls. |