Users and accounts
Find an account, read what it holds, assign roles, ban and restore, and repair a credit balance.
On /admin/users/dashboard an operator looks up one account: what it
bought, what it holds, and why it cannot sign in. The page is not a CRM. It has no free-text
notes about a customer and shows only the rows the product wrote.
Before you begin
users.readto open the directory and a detail page,users.writeto change a status, androles.writeto change which roles an account holds. See Roles and permissions.- The three permissions are separate so that you can grant them independently. Support staff usually need the first, rarely the second, and not the third.
Set it up
Open the directory
/admin/users/dashboard lists accounts with their status and roles. Search by name or e-mail.
Open one account
/admin/users/$userId shows the account's roles, its access profile status, its licences, its
credit balance and its recent activity. These are the same rows the customer sees at /app, read
from the same repositories.
Ban or restore
A banned account keeps its rows and loses its session. The guards reject it at the layout, so every
/app and /admin page is blocked without a per-page check. Restoring the account lifts the ban.
No data is deleted in between.
Repair a credit balance
If the ledger and the cached balance disagree, adminRepairUserCreditBalance({ userId })
recomputes the balance from the ledger entries. It is the button on the detail page and requires
credits.write. Users cannot call it, and no self-service path writes a balance.
Account status
Prop
Type
Authorization is enforced in users-rbac.ts by each server operation through requireAdminPermission. Being able to see the page does not grant permission to act.
Verify
- Open
/admin/users/dashboardwith a role that has onlyusers.read. The list renders and the ban action is rejected. - Ban an account, then try to open
/appas that account. The layout rejects it, so no/apppage opens. - Restore it. The same account signs in again with its licences and credits intact.
- Add a role to an account and reload its detail page. The permission list is the union of its roles.
Reference
- Roles and permissions
- Authentication: where identity is resolved
- Better Auth: users and accounts