Pure functions for creating audit log entries.
This namespace contains CORE (pure) functions for audit trail management. In FC/IS architecture, this is the CORE that:
Key FC/IS principles:
Pure functions for creating audit log entries. This namespace contains CORE (pure) functions for audit trail management. In FC/IS architecture, this is the CORE that: - Contains pure business logic for audit entry creation - No side effects - returns data structures only - All I/O is delegated to shell layer (persistence) Key FC/IS principles: - Pure functions only - deterministic, no side effects - Returns data that shell layer will persist - Business rules for what gets audited and how
(activate-user-audit-entry actor-id
actor-email
target-user-id
target-user-email
ip-address
user-agent)Create audit log entry for user activation.
Args: actor-id: UUID of user who performed the action actor-email: Email of actor target-user-id: UUID of user being activated target-user-email: Email of user being activated ip-address: Optional IP address user-agent: Optional user agent string
Returns: Audit log entity map
Create audit log entry for user activation. Args: actor-id: UUID of user who performed the action actor-email: Email of actor target-user-id: UUID of user being activated target-user-email: Email of user being activated ip-address: Optional IP address user-agent: Optional user agent string Returns: Audit log entity map
(bulk-action-audit-entry actor-id
actor-email
action-type
user-ids
ip-address
user-agent
additional-metadata)Create audit log entry for bulk operations.
Args: actor-id: UUID of user who performed the action actor-email: Email of actor action-type: Type of bulk action (:deactivate, :activate, :delete, :role-change) user-ids: Vector of affected user IDs ip-address: Optional IP address user-agent: Optional user agent string additional-metadata: Optional map with extra context
Returns: Audit log entity map
Note: For bulk operations, we create one audit entry per affected user, each with metadata indicating it was part of a bulk operation.
Create audit log entry for bulk operations.
Args:
actor-id: UUID of user who performed the action
actor-email: Email of actor
action-type: Type of bulk action (:deactivate, :activate, :delete, :role-change)
user-ids: Vector of affected user IDs
ip-address: Optional IP address
user-agent: Optional user agent string
additional-metadata: Optional map with extra context
Returns:
Audit log entity map
Note: For bulk operations, we create one audit entry per affected user,
each with metadata indicating it was part of a bulk operation.(create-user-audit-entry actor-id actor-email target-user ip-address user-agent)Create audit log entry for user creation.
Pure function that constructs audit log data structure.
Args: actor-id: UUID of user who performed the action (nil for system) actor-email: Email of actor target-user: Created user entity map ip-address: Optional IP address user-agent: Optional user agent string
Returns: Audit log entity map ready for persistence
Example: (create-user-audit-entry admin-id "admin@example.com" new-user "192.168.1.1" "Mozilla...")
Create audit log entry for user creation. Pure function that constructs audit log data structure. Args: actor-id: UUID of user who performed the action (nil for system) actor-email: Email of actor target-user: Created user entity map ip-address: Optional IP address user-agent: Optional user agent string Returns: Audit log entity map ready for persistence Example: (create-user-audit-entry admin-id "admin@example.com" new-user "192.168.1.1" "Mozilla...")
(deactivate-user-audit-entry actor-id
actor-email
target-user-id
target-user-email
ip-address
user-agent)Create audit log entry for user deactivation (soft delete).
Args: actor-id: UUID of user who performed the action actor-email: Email of actor target-user-id: UUID of user being deactivated target-user-email: Email of user being deactivated ip-address: Optional IP address user-agent: Optional user agent string
Returns: Audit log entity map
Create audit log entry for user deactivation (soft delete). Args: actor-id: UUID of user who performed the action actor-email: Email of actor target-user-id: UUID of user being deactivated target-user-email: Email of user being deactivated ip-address: Optional IP address user-agent: Optional user agent string Returns: Audit log entity map
(delete-user-audit-entry actor-id
actor-email
target-user-id
target-user-email
ip-address
user-agent)Create audit log entry for permanent user deletion.
Args: actor-id: UUID of user who performed the action actor-email: Email of actor target-user-id: UUID of user being deleted target-user-email: Email of user being deleted ip-address: Optional IP address user-agent: Optional user agent string
Returns: Audit log entity map
Create audit log entry for permanent user deletion. Args: actor-id: UUID of user who performed the action actor-email: Email of actor target-user-id: UUID of user being deleted target-user-email: Email of user being deleted ip-address: Optional IP address user-agent: Optional user agent string Returns: Audit log entity map
(login-audit-entry user-id
user-email
ip-address
user-agent
success?
error-message)Create audit log entry for user login.
Args: user-id: UUID of user who logged in user-email: Email of user ip-address: IP address of login user-agent: User agent string success?: Whether login was successful error-message: Optional error message if login failed
Returns: Audit log entity map
Create audit log entry for user login. Args: user-id: UUID of user who logged in user-email: Email of user ip-address: IP address of login user-agent: User agent string success?: Whether login was successful error-message: Optional error message if login failed Returns: Audit log entity map
(logout-audit-entry user-id user-email ip-address user-agent)Create audit log entry for user logout.
Args: user-id: UUID of user who logged out user-email: Email of user ip-address: Optional IP address user-agent: Optional user agent string
Returns: Audit log entity map
Create audit log entry for user logout. Args: user-id: UUID of user who logged out user-email: Email of user ip-address: Optional IP address user-agent: Optional user agent string Returns: Audit log entity map
(role-change-audit-entry actor-id
actor-email
target-user-id
target-user-email
old-role
new-role
ip-address
user-agent)Create audit log entry for user role change.
Args: actor-id: UUID of user who performed the action actor-email: Email of actor target-user-id: UUID of user whose role changed target-user-email: Email of user old-role: Previous role keyword new-role: New role keyword ip-address: Optional IP address user-agent: Optional user agent string
Returns: Audit log entity map
Create audit log entry for user role change. Args: actor-id: UUID of user who performed the action actor-email: Email of actor target-user-id: UUID of user whose role changed target-user-email: Email of user old-role: Previous role keyword new-role: New role keyword ip-address: Optional IP address user-agent: Optional user agent string Returns: Audit log entity map
(sanitize-audit-metadata metadata)Remove sensitive data from audit metadata before persistence.
Pure function that filters out password fields, tokens, etc.
Args: metadata: Metadata map that may contain sensitive data
Returns: Sanitized metadata map
Remove sensitive data from audit metadata before persistence. Pure function that filters out password fields, tokens, etc. Args: metadata: Metadata map that may contain sensitive data Returns: Sanitized metadata map
(update-user-audit-entry actor-id
actor-email
target-user-id
target-user-email
old-values
new-values
ip-address
user-agent)Create audit log entry for user update.
Args: actor-id: UUID of user who performed the action actor-email: Email of actor target-user-id: UUID of user being updated target-user-email: Email of user being updated old-values: Map of old field values new-values: Map of new field values ip-address: Optional IP address user-agent: Optional user agent string
Returns: Audit log entity map
Example: (update-user-audit-entry actor-id "admin@example.com" user-id "user@example.com" {:role :user} {:role :admin} "192.168.1.1" nil)
Create audit log entry for user update.
Args:
actor-id: UUID of user who performed the action
actor-email: Email of actor
target-user-id: UUID of user being updated
target-user-email: Email of user being updated
old-values: Map of old field values
new-values: Map of new field values
ip-address: Optional IP address
user-agent: Optional user agent string
Returns:
Audit log entity map
Example:
(update-user-audit-entry actor-id "admin@example.com" user-id "user@example.com"
{:role :user} {:role :admin} "192.168.1.1" nil)(valid-audit-entry? audit-entry)Validate that an audit entry has all required fields.
Args: audit-entry: Audit entry map to validate
Returns: Boolean indicating if entry is valid
Validate that an audit entry has all required fields. Args: audit-entry: Audit entry map to validate Returns: Boolean indicating if entry is valid
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |