Modules (Admin)
Executive summary
Section titled “Executive summary”The Modules registry defines feature keys (e.g. item) that roles reference. Non–Master admins (modules is an array) cannot mutate registry entries—UI disables those actions.
Goals and non-goals
Section titled “Goals and non-goals”| Goals | Non-goals |
|---|---|
Explain registry vs role modules JSON | Change backend guard keys without code deploy |
| Document list/detail routes | List every module row in every environment |
Current platform behavior
Section titled “Current platform behavior”- Roles store
modules: string[] | null—nullmeans all modules (Roles). - Registry CRUD is disabled in the UI unless the admin JWT has
modules === null(Master) (Admin overview).
Sequence: happy path
Section titled “Sequence: happy path”- Master admin opens Modules → reviews keys and metadata.
- Aligns new feature work with a module key → updates Roles to grant keys to appropriate roles.
Security and operations
Section titled “Security and operations”- Treat module keys as contract with backend guards—coordinate releases when adding keys.
- Avoid duplicate keys; document in changelog when adding a new module.
Test scenarios (UAT / QA)
Section titled “Test scenarios (UAT / QA)”| ID | Scenario | Expected |
|---|---|---|
| MD1 | Role-limited admin opens Modules | Mutations disabled or API 403 |
| MD2 | Master admin edits registry | Persists if API allows |
| MD3 | Role without new key | Feature APIs return 403 |
Routes
Section titled “Routes”| Path | Purpose |
|---|---|
/dashboard/modules | Module list |
/dashboard/modules/:id | Module detail |
Relation to roles
Section titled “Relation to roles”Roles store a JSON modules array (or null for full access). Each entry is a string key the backend guards check (for example catalog item). The Modules screen maintains the registry of module records that correspond to those keys.
See Roles (Admin) for JWT modules semantics.
List and mutations
Section titled “List and mutations”- Search — debounced, paginated list via
fetchAdminModulesList. - Create / edit — modal form; navigation can pre-open edit or delete via router
location.state(editModuleId,deleteModuleId, etc.). - Delete — confirmation modal, then
deleteAdminModule.
Master-only registry mutations
Section titled “Master-only registry mutations”The page sets canMutate when profile.modules == null (Master admin). If modules is an array, canMutate is false: create, edit, and delete affordances for the module registry are disabled. All admins can still view lists when the API allows.