X Enterprises
Composables

useXAdminUsers

Provides admin actions for user management including role updates, suspension, password reset, and hard or soft deletion.

useXAdminUsers

User management composable. Wraps the /api/admin/users/* endpoints with typed async actions for role assignment, suspension, password resets, and deletion. Pairs with XAdminUsersDirectory for the list view and XAdminUsersDetail for per-user actions.

Usage

const admin = useXAdminUsers()

await admin.updateRole(userId, "editor")
await admin.suspendUser(userId, "Violation of TOS")
await admin.unsuspendUser(userId)
await admin.resetPassword(userId)
await admin.deleteUser(userId, { hardDelete: false })

Returns

KeyTypeDescription
updateRole(userId: string, role: string) => Promise<void>Assigns a new role to the specified user.
suspendUser(userId: string, reason: string) => Promise<void>Suspends a user account with an optional reason.
unsuspendUser(userId: string) => Promise<void>Lifts a suspension and restores user access.
resetPassword(userId: string) => Promise<void>Triggers a password-reset flow for the user.
deleteUser(userId: string, opts?: { hardDelete: boolean }) => Promise<void>Soft- or hard-deletes a user account.

AI Context

composable: useXAdminUsers
package: "@xenterprises/nuxt-x-app-admin"
use-when: >
  Performing admin-level user actions — changing roles, suspending or unsuspending
  accounts, forcing password resets, or deleting users. Uses Better Auth endpoints
  under /api/admin/users/*.
pairs-with: XAdminUsersDirectory, XAdminUsersDetail, XAdminUsersProfile, XAdminUsersSessions
Copyright © 2026