User detail
The per-member admin view in Pact — a user's role, effective permissions, recent activity, and the actions to change role, elevate temporarily, or disable them.
User detail
The user detail view is the single-member drill-down behind the team roster. It shows who a user is, what role they hold, what that role can actually do, and a slice of their recent activity — with controls to change their role, grant temporary elevation, or disable the account. All endpoints require the admin module and are tenant-scoped (api/routes/team.py).
Read a member
GET /v1/team/members/{user_id} →
{
"id": 42,
"email": "[email protected]",
"name": "Sarah Lee",
"role": "manager",
"effective_role": "admin", // reflects any active JIT elevation
"status": "active",
"last_login_at": "...",
"permissions": [ ... ], // effective permission set
"history": [ { "event_type": "...", "payload": {...}, "occurred_at": "..." } ]
}
effective_role differs from role when the user has an active just-in-time elevation — the read path calls observe_jit, which also reverts any expired elevation and audits it. The permissions array is the fully-resolved set for the effective role, including per-tenant overrides. history is a short tail of the member's recent audit events.
Change a role
POST /v1/team/members/{user_id}/role
{ "role": "admin", "reason": "promoted to team lead" }
Valid roles: owner, admin, manager, member, viewer, api. Changing a role clears the user's cached API key hash so the new permission set takes effect on their next request, and emits team.role.changed.
Temporary elevation
POST /v1/team/members/{user_id}/elevate
{ "role": "admin", "duration_hours": 4, "reason": "incident response" }
Grants an elevated role for 1–168 hours with a required reason. The elevation is time-bounded and auto-reverts (emitting team.role.elevated on grant and an audit event on expiry). Use this instead of a permanent role change for break-fix work.
Disable a member
POST /v1/team/members/{user_id}/disable
{ "reason": "offboarded" }
Sets the user's status to suspended and clears their API key hash, immediately invalidating their sessions. Emits team.member.disabled.
Where these actions are recorded
Every mutation on this page — role change, elevation, disable — writes to the audit log with the acting admin's identity and the reason string. Reasons are optional on role change and disable, but required on elevation.