Class: Provenance::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/provenance/configuration.rb

Overview

Holds the global configuration: the data source name, the list of sensitive attributes, the delivery hooks and the value providers used to enrich every audit event.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/provenance/configuration.rb', line 12

def initialize
  @source_name = "app_#{Rails.env}"
  @sensitive_attributes = []
  @audit_hooks = []
  @enabled = !Rails.env.test?
  @track_bulk_operations = false
  @bulk_operations_max_ids = 1000
  @username_provider = nil
  @roles_provider = nil
  @remote_ip_provider = nil
  @origin_ip_provider = nil
  @session_id_provider = nil
end

Instance Attribute Details

#audit_hooksObject

Returns the value of attribute audit_hooks.



8
9
10
# File 'lib/provenance/configuration.rb', line 8

def audit_hooks
  @audit_hooks
end

#bulk_operations_max_idsObject

Returns the value of attribute bulk_operations_max_ids.



8
9
10
# File 'lib/provenance/configuration.rb', line 8

def bulk_operations_max_ids
  @bulk_operations_max_ids
end

#enabledObject

Returns the value of attribute enabled.



8
9
10
# File 'lib/provenance/configuration.rb', line 8

def enabled
  @enabled
end

#origin_ip_providerObject

Returns the value of attribute origin_ip_provider.



8
9
10
# File 'lib/provenance/configuration.rb', line 8

def origin_ip_provider
  @origin_ip_provider
end

#remote_ip_providerObject

Returns the value of attribute remote_ip_provider.



8
9
10
# File 'lib/provenance/configuration.rb', line 8

def remote_ip_provider
  @remote_ip_provider
end

#roles_providerObject

Returns the value of attribute roles_provider.



8
9
10
# File 'lib/provenance/configuration.rb', line 8

def roles_provider
  @roles_provider
end

#sensitive_attributesObject

Returns the value of attribute sensitive_attributes.



8
9
10
# File 'lib/provenance/configuration.rb', line 8

def sensitive_attributes
  @sensitive_attributes
end

#session_id_providerObject

Returns the value of attribute session_id_provider.



8
9
10
# File 'lib/provenance/configuration.rb', line 8

def session_id_provider
  @session_id_provider
end

#source_nameObject

Returns the value of attribute source_name.



8
9
10
# File 'lib/provenance/configuration.rb', line 8

def source_name
  @source_name
end

#track_bulk_operationsObject

Returns the value of attribute track_bulk_operations.



8
9
10
# File 'lib/provenance/configuration.rb', line 8

def track_bulk_operations
  @track_bulk_operations
end

#username_providerObject

Returns the value of attribute username_provider.



8
9
10
# File 'lib/provenance/configuration.rb', line 8

def username_provider
  @username_provider
end

Instance Method Details

#add_audit_hook(&block) ⇒ Object



26
27
28
# File 'lib/provenance/configuration.rb', line 26

def add_audit_hook(&block)
  @audit_hooks << block
end

#clear_audit_hooksObject



30
31
32
# File 'lib/provenance/configuration.rb', line 30

def clear_audit_hooks
  @audit_hooks.clear
end