PhoenixKit.AuditLog.Entry (phoenix_kit v1.7.39)

Copy Markdown View Source

Schema for audit log entries.

Tracks administrative actions performed in PhoenixKit, providing a complete audit trail of sensitive operations.

Fields

  • target_user_id - The ID of the user affected by the action
  • admin_user_id - The ID of the admin who performed the action
  • action - The type of action performed (e.g., "admin_password_reset")
  • ip_address - The IP address from which the action was performed
  • user_agent - The user agent string of the client
  • metadata - Additional metadata about the action (JSONB)
  • inserted_at - Timestamp when the log entry was created

Summary

Functions

Creates a changeset for audit log entry.

Returns the list of valid action types.

Types

t()

@type t() :: %PhoenixKit.AuditLog.Entry{
  __meta__: term(),
  action: String.t(),
  admin_user_id: integer(),
  admin_user_uuid: UUIDv7.t() | nil,
  id: integer() | nil,
  inserted_at: DateTime.t() | nil,
  ip_address: String.t() | nil,
  metadata: map() | nil,
  target_user_id: integer(),
  target_user_uuid: UUIDv7.t() | nil,
  user_agent: String.t() | nil,
  uuid: UUIDv7.t() | nil
}

Functions

changeset(entry, attrs)

Creates a changeset for audit log entry.

Required Fields

  • :target_user_id - ID of the affected user
  • :admin_user_id - ID of the admin performing the action
  • :action - Type of action performed

Optional Fields

  • :ip_address - IP address of the admin
  • :user_agent - User agent string
  • :metadata - Additional metadata (JSONB)

valid_actions()

Returns the list of valid action types.