AdminUserEditPanel
Admin user-edit panel. Surfaces the slice of admin operations a back-office user-management page needs:
- Role assignment — toggle a curated list of role codes; calls
PUT /admin/users/{id}/roles. - Set password — admin can reset without the user’s current
password; calls
POST /auth/admin/set-password. - Hard-delete — calls
DELETE /admin/users/{id}/hard(system_admin only on the server; we gate the button oncurrentUserIsSystemAdmin).
Composes the UserAvatar atom for visual identity. Caller-gated:
always wrap this in <RoleGate anyOf={['system_admin','super_admin']}>
upstream — the server enforces but a gate prevents the UI from showing
up at all for non-admins.
Usage
import { AdminUserEditPanel } from '@rw3iss/auth-client/preact/forms';
<AdminUserEditPanel user={/* LookupUserRecord */}/>Props
| Name | Type | Description |
|---|---|---|
user | LookupUserRecord | (required) |
client | AuthClient | |
assignableRoles | string[] | Role codes the admin can toggle. Default: a reasonable subset. |
currentRoles | string[] | Currently-assigned role codes. |
currentUserIsSystemAdmin | boolean | Whether the caller is system_admin — gates the hard-delete affordance. |
onSaved | () => void | Fired after a successful save action (any of roles / password). |
onDeleted | () => void | Fired after a successful hard-delete; consumer navigates away. |
include | Array<'header' | 'roles' | 'password' | 'lockout' | 'danger'> | Which sections to render, in case the consumer wants to lay them out across its own columns. Defaults to all. (`danger` still also requires `currentUserIsSystemAdmin`.) Sections: - `header` — avatar + name + email - `roles` — base-role toggles + save - `password` — admin set-password - `lockout` — clear failed-login lockout (count + lock) - `danger` — hard-delete / |
headerActions | ComponentChildren | Rendered at the right of the header — app-specific actions such as a link to the user’s public profile in the consuming product (the SDK knows nothing about that product’s URLs). |
className | string |