AshAuthentication.AddOn.AuditLog.Auditor (ash_authentication v5.0.0-rc.8)

Copy Markdown View Source

Provides common audit logging behaviour for Ash actions.

Summary

Functions

Record a status override for the audit log entry that will be written for this action.

Tag a query/changeset/action input with a unique reference used to bridge status overrides from downstream after_action callbacks into the audit log's after_transaction callback.

Types

input()

@type input() :: Ash.ActionInput.t() | Ash.Changeset.t() | Ash.Query.t()

result()

@type result() ::
  {:ok, Ash.Resource.record()}
  | {:ok, [Ash.Resource.record()]}
  | {:error, any()}

Functions

record_status_override(input, status)

@spec record_status_override(input(), :success | :failure | :unknown) :: :ok

Record a status override for the audit log entry that will be written for this action.

Called from a preparation's after_action (or change's after_action) when the result of the action alone is not sufficient to determine whether the operation should be recorded as :success or :failure (for example, password reset and magic-link request actions return :ok regardless of whether the submitted identity resolved to a known user).

If the audit-log add-on is not configured for this action, this call is a no-op.

tag_status_override_ref(input)

@spec tag_status_override_ref(input()) :: input()

Tag a query/changeset/action input with a unique reference used to bridge status overrides from downstream after_action callbacks into the audit log's after_transaction callback.

Called automatically by the audit-log Preparation and Change modules; you should not need to call this directly.