Summary
Implement super-admin impersonation per the session blob's impersonator_user_id field (doc 06 §5.1). A super_admin can start an impersonation session against another user; the session blob carries both the impersonated user_id and the original impersonator_user_id. The audit log captures both. Impersonation is loud: the admin shell shows a persistent banner "You are impersonating — Stop impersonating", every audit event is double-tagged, and certain destructive actions (delete user, change roles for super_admins) are blocked while impersonating. Stop returns to the original session.
Design reference
- docs/06-auth-permissions.md §5.1 (Sessions —
impersonator_user_id)
Acceptance criteria
Dependencies
Depends on Session store, Roles + capabilities + policy package, Audit log.
Complexity
M
Summary
Implement super-admin impersonation per the session blob's
impersonator_user_idfield (doc 06 §5.1). Asuper_admincan start an impersonation session against another user; the session blob carries both the impersonateduser_idand the originalimpersonator_user_id. The audit log captures both. Impersonation is loud: the admin shell shows a persistent banner "You are impersonating — Stop impersonating", every audit event is double-tagged, and certain destructive actions (delete user, change roles for super_admins) are blocked while impersonating. Stop returns to the original session.Design reference
impersonator_user_id)Acceptance criteria
POST /api/v1/admin/impersonate/{user_id}(capabilitysuper_admin-only) creates a new session blob withimpersonator_user_id = current_user_id,user_id = target_user_idPOST /api/v1/admin/impersonate/stoprestores the original sessionimpersonator_user_id != nullauth.impersonate.startandauth.impersonate.stopwith both actor and targetsuper_adminDependencies
Depends on Session store, Roles + capabilities + policy package, Audit log.
Complexity
M