Skip to content
rw3iss Auth

AdminUserEditPanel

form @rw3iss/auth-client/preact/forms/AdminUserEditPanel framework-adapters/preact/components/forms/AdminUserEditPanel.tsx ↗

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 on currentUserIsSystemAdmin).

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

NameTypeDescription
userLookupUserRecord(required)
clientAuthClient
assignableRolesstring[]Role codes the admin can toggle. Default: a reasonable subset.
currentRolesstring[]Currently-assigned role codes.
currentUserIsSystemAdminbooleanWhether the caller is system_admin — gates the hard-delete affordance.
onSaved() => voidFired after a successful save action (any of roles / password).
onDeleted() => voidFired after a successful hard-delete; consumer navigates away.
classNamestring