Scope-safe loader for the admin user detail surface.
Summary
Functions
Returns up to @audit_preview_limit most-recent audit events for user_id,
already shaped by Sigra.Admin.Audit.Presenter.present/2.
Functions
@spec load!(map(), Sigra.Admin.Scope.t(), binary()) :: map()
@spec load_user!(map(), Sigra.Admin.Scope.t(), binary()) :: struct()
@spec recent_audit_preview(map(), Sigra.Admin.Scope.t(), binary()) :: [map()]
Returns up to @audit_preview_limit most-recent audit events for user_id,
already shaped by Sigra.Admin.Audit.Presenter.present/2.
Each returned row is a map with the guaranteed keys:
:id— audit event id (binary):inserted_at—DateTime.t():action— raw action string (e.g."admin.impersonation.start"):action_label— human-readable label (e.g."Impersonation started"):action_badge—"Impersonation"when the row represents impersonation activity, otherwisenil:actor_label,:effective_user_label— individual user labels for the full explorer:actor_summary— combined label preferred by compact previews:outcome—event.outcome || "success"
Preview renderers MUST NOT introduce fields outside this set (see D-07 in the
Phase 33 context). If a new preview field is needed, add it to
Sigra.Admin.Audit.Presenter first so the preview and the full explorer stay
coherent.