Class: GdprAdmin::ApplicationDataPolicy
- Inherits:
-
Object
- Object
- GdprAdmin::ApplicationDataPolicy
- Defined in:
- lib/gdpr_admin/application_data_policy.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.before_process_hooks ⇒ Object
readonly
Returns the value of attribute before_process_hooks.
-
.before_process_record_hooks ⇒ Object
readonly
Returns the value of attribute before_process_record_hooks.
Class Method Summary collapse
Instance Method Summary collapse
- #erase(_record) ⇒ Object
- #export(_record) ⇒ Object
-
#initialize(request) ⇒ ApplicationDataPolicy
constructor
A new instance of ApplicationDataPolicy.
- #process ⇒ Object
- #process_scope ⇒ Object
- #scope ⇒ Object
Methods included from Helpers::ScopeHelper
Methods included from Helpers::EraseHelper
Methods included from Helpers::PaperTrailHelper
#anonymize_version_object, #anonymize_version_object_changes, #without_paper_trail
Methods included from Helpers::FieldAnonymizerHelper
#anonymize_field, #nilify, #nullify, #with_seed
Methods included from GdprAdmin::Anonymizers::InternetAnonymizer
#anonymize_email, #anonymize_ip, #anonymize_password, #mask_ip
Methods included from GdprAdmin::Anonymizers::ContactAnonymizer
#anonymize_city, #anonymize_country, #anonymize_country_code2, #anonymize_country_code3, #anonymize_phone_number, #anonymize_state, #anonymize_street_address, #anonymize_zip
Methods included from GdprAdmin::Anonymizers::CompanyAnonymizer
Methods included from GdprAdmin::Anonymizers::NameAnonymizer
#anonymize_first_name, #anonymize_last_name, #anonymize_name
Methods included from Helpers::DataPolicyHelper
#model_data_policy_class, #skip_data_policy!, #skip_record!
Constructor Details
#initialize(request) ⇒ ApplicationDataPolicy
Returns a new instance of ApplicationDataPolicy.
27 28 29 |
# File 'lib/gdpr_admin/application_data_policy.rb', line 27 def initialize(request) @request = request end |
Class Attribute Details
.before_process_hooks ⇒ Object (readonly)
Returns the value of attribute before_process_hooks.
10 11 12 |
# File 'lib/gdpr_admin/application_data_policy.rb', line 10 def before_process_hooks @before_process_hooks end |
.before_process_record_hooks ⇒ Object (readonly)
Returns the value of attribute before_process_record_hooks.
10 11 12 |
# File 'lib/gdpr_admin/application_data_policy.rb', line 10 def before_process_record_hooks @before_process_record_hooks end |
Class Method Details
.before_process(method) ⇒ Object
12 13 14 15 |
# File 'lib/gdpr_admin/application_data_policy.rb', line 12 def before_process(method) @before_process_hooks ||= [] @before_process_hooks << method end |
.before_process_record(method) ⇒ Object
17 18 19 20 |
# File 'lib/gdpr_admin/application_data_policy.rb', line 17 def before_process_record(method) @before_process_record_hooks ||= [] @before_process_record_hooks << method end |
.process(request) ⇒ Object
22 23 24 |
# File 'lib/gdpr_admin/application_data_policy.rb', line 22 def process(request) new(request).process end |
Instance Method Details
#erase(_record) ⇒ Object
39 40 41 |
# File 'lib/gdpr_admin/application_data_policy.rb', line 39 def erase(_record) raise NotImplementedError end |
#export(_record) ⇒ Object
35 36 37 |
# File 'lib/gdpr_admin/application_data_policy.rb', line 35 def export(_record) raise NotImplementedError end |
#process ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/gdpr_admin/application_data_policy.rb', line 43 def process GdprAdmin.config.tenant_adapter.with_tenant(request.tenant) do run_preprocessors process_scope rescue SkipDataPolicyError nil end end |
#process_scope ⇒ Object
52 53 54 55 56 |
# File 'lib/gdpr_admin/application_data_policy.rb', line 52 def process_scope policy_scope.find_each do |record| process_record(record) end end |
#scope ⇒ Object
31 32 33 |
# File 'lib/gdpr_admin/application_data_policy.rb', line 31 def scope skip_data_policy! end |