Chronicle. Phoenix
(chronicle v0.1.2)
Copy Markdown
Builds audit context from a Plug.Conn.
The default actor mapper records only a type and id; it never serializes the
entire user struct. Use :actor or :actor_mapper for application-specific
identity.
Request provenance — method, path, remote IP, request id — is contextual
data, so it lands under metadata["http"] rather than in a column nothing
queries.
Summary
Functions
Runs one Phoenix request action as an audited group.
Runs a block with request audit context without leaking it to subsequent work in the same process.
Functions
@spec context( Plug.Conn.t(), keyword() ) :: map()
@spec put_context( Plug.Conn.t(), keyword() ) :: Plug.Conn.t()
Runs one Phoenix request action as an audited group.
Takes a do block or a zero-arity function. Option values for :actor,
:subject, :data, and :metadata may be one-argument functions that
receive the connection.
Runs a block with request audit context without leaking it to subsequent work in the same process.
Takes a do block or a zero-arity function, like Chronicle.transaction/3:
Chronicle.Phoenix.with_context conn do
Accounts.disable(account)
end