@xeplr/ui-account 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -314,7 +314,7 @@ Call `registerMTs(slots)` once at boot with **the same shape** passed to `@xeplr
|
|
|
314
314
|
- **Adding a role.** The User Roles page has a New role field (`createRole`). The role appears as a column there and in the Access Matrix straight away. The server allows it for Super Admin only; anyone else sees its refusal.
|
|
315
315
|
- **Access states.** Each Modules cell is three-way, not a checkbox: **Enabled** (shown and usable), **Disabled** (shown, greyed out, not usable) or **Hidden** (not shown). A role only partly granted shows **Mixed**. `handleStateChange(module, action, roleId, state)` saves a change; `handleModuleToggle` still works for designs written before.
|
|
316
316
|
- **Applies to: Roles, Workspace or User.** Roles are the defaults. A workspace or a user can override them per module and action, and an override may be **Inherit** (no override). Workspaces belong to the host product, not the auth service, so the host passes them: `authRoutes({ accessMatrix: { props: { loadWorkspaces } } })`, or `workspaces` directly.
|
|
317
|
-
- **Server support.** Enabled and Hidden
|
|
317
|
+
- **Server support.** On roles, all three work: Enabled and Hidden are the role mapping (`module-role`), Disabled is the mapping row's state (`module-state`, `@xeplr/auth` 0013). Workspace and user overrides are not stored yet: the server answers `SCOPE_NOT_SUPPORTED`, and the matrix says so and refuses to save them rather than pretending they were saved.
|
|
318
318
|
- `MASTER_TYPES` is `['roles', 'apis', 'pages', 'elements', 'menus']`.
|
|
319
319
|
|
|
320
320
|
### Design validation
|
|
@@ -363,8 +363,8 @@ Admin (auth):
|
|
|
363
363
|
| `toggleUserRole({ userId, roleId, assign })` | `POST /auth/api/admin/user-role` |
|
|
364
364
|
| `toggleAccessRole({ type, itemId, roleId, assign })` | `POST /auth/api/admin/access-role` |
|
|
365
365
|
| `toggleModuleRole({ module, action, roleId, assign })` | `POST /auth/api/admin/module-role` |
|
|
366
|
-
| `getModuleStates({ scope, scopeId })` | `GET /auth/api/admin/module-states?scope=role\|workspace\|user&scopeId=…` → `[{ module, action, roleId?, state }]`.
|
|
367
|
-
| `setModuleState({ scope, scopeId, module, action, roleId, state })` | `POST /auth/api/admin/module-state`. `state` is `enabled` / `
|
|
366
|
+
| `getModuleStates({ scope, scopeId })` | `GET /auth/api/admin/module-states?scope=role\|workspace\|user&scopeId=…` → `[{ module, action, roleId?, state }]`. `role` only so far; other scopes answer `400 SCOPE_NOT_SUPPORTED` |
|
|
367
|
+
| `setModuleState({ scope, scopeId, module, action, roleId, state })` | `POST /auth/api/admin/module-state`. `state` is `disabled`, or `enabled` / `null` to clear (hidden is removing the mapping, through `module-role`). `role` only so far |
|
|
368
368
|
| `setApiScope(id, scope)` | `POST /auth/api/admin/master/apis/scope`. Super Admin only; `scope` is `system` or `company` |
|
|
369
369
|
| `getMasterItems(type)`, `saveMasterItem(type, data)`, `deleteMasterItem(type, id)` | `GET` / `POST /auth/api/admin/master/<type>`, `POST …/<type>/delete` |
|
|
370
370
|
| `listMenuItems`, `saveMenuItems`, `addMenuItem`, `removeMenuItem` | see [Changing the menu](#changing-the-menu) |
|
package/package.json
CHANGED
|
@@ -51,8 +51,8 @@ export default function AccessMatrixSample({
|
|
|
51
51
|
|
|
52
52
|
{activeView === 'modules' && statesSupported === false && (
|
|
53
53
|
<div className="xeplr-admin-alert xeplr-admin-alert-info">
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
Workspace and user overrides are not stored yet. Roles work today: Enabled, Disabled
|
|
55
|
+
and Hidden.
|
|
56
56
|
</div>
|
|
57
57
|
)}
|
|
58
58
|
|
|
@@ -64,7 +64,7 @@ export function useAccessMatrixController(props) {
|
|
|
64
64
|
setStoredStates(indexStates(rows));
|
|
65
65
|
setStatesSupported(true);
|
|
66
66
|
} catch (err) {
|
|
67
|
-
//
|
|
67
|
+
// Not stored for this scope (the server stores role states only, so far):
|
|
68
68
|
// the design shows a notice rather than pretending overrides exist.
|
|
69
69
|
setStoredStates({});
|
|
70
70
|
setStatesSupported(false);
|