Liking cljdoc? Tell your friends :D

boundary.user.core.audit

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
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
raw docstring

activate-user-audit-entryclj

(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
sourceraw docstring

bulk-action-audit-entryclj

(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.
sourceraw docstring

create-user-audit-entryclj

(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...")
sourceraw docstring

deactivate-user-audit-entryclj

(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
sourceraw docstring

delete-user-audit-entryclj

(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
sourceraw docstring

login-audit-entryclj

(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
sourceraw docstring

logout-audit-entryclj

(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
sourceraw docstring

role-change-audit-entryclj

(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
sourceraw docstring

sanitize-audit-metadataclj

(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
sourceraw docstring

update-user-audit-entryclj

(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)
sourceraw docstring

valid-audit-entry?clj

(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
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close