gdpr_admin 1.4.0 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gdpr_admin/application_data_policy.rb +12 -4
- data/lib/gdpr_admin/helpers/data_policy_helper.rb +10 -0
- data/lib/gdpr_admin/helpers/paper_trail_helper.rb +1 -1
- data/lib/gdpr_admin/paper_trail/version_data_policy.rb +1 -7
- data/lib/gdpr_admin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ec941ad2e7b5708375e99e895438d87a0ba4d444793e160eb856153e50416e4
|
4
|
+
data.tar.gz: 3c32e9b55b937b8ae8f3985aa94303cdacb2886ecd310b698cc42131425ae449
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ce2ae11b31814d2a70da810245f966247a1bff2080a6c65c44b25df4d29af81bebd04f8e0d8ae75b25f06c1a9d5e0ca40941620404dd1f8dae9f02d05a9cac0
|
7
|
+
data.tar.gz: bfee1582a3e58facf792acf4ca077cf880009d3c75129d39d6ad2203481a86805b8a2de3fd505c2246f3ebf3fd052e53e3dca4defba73657f51ebde27a0cba8a
|
@@ -43,14 +43,18 @@ module GdprAdmin
|
|
43
43
|
def process
|
44
44
|
GdprAdmin.config.tenant_adapter.with_tenant(request.tenant) do
|
45
45
|
run_preprocessors
|
46
|
-
scope
|
47
|
-
process_record(record)
|
48
|
-
end
|
46
|
+
process_scope(scope)
|
49
47
|
rescue SkipDataPolicyError
|
50
48
|
nil
|
51
49
|
end
|
52
50
|
end
|
53
51
|
|
52
|
+
def process_scope(scope)
|
53
|
+
scope.find_each do |record|
|
54
|
+
process_record(record)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
54
58
|
protected
|
55
59
|
|
56
60
|
attr_reader :request
|
@@ -80,9 +84,13 @@ module GdprAdmin
|
|
80
84
|
def call_hook(hook, value = nil)
|
81
85
|
hook = method(hook) unless hook.respond_to?(:call)
|
82
86
|
|
83
|
-
arity = hook
|
87
|
+
arity = arity_of(hook)
|
84
88
|
args = [value].take(arity).reverse
|
85
89
|
instance_exec(*args, &hook)
|
86
90
|
end
|
91
|
+
|
92
|
+
def arity_of(method_or_proc)
|
93
|
+
defined?(T::Utils.arity) ? T::Utils.arity(method_or_proc) : method_or_proc.arity
|
94
|
+
end
|
87
95
|
end
|
88
96
|
end
|
@@ -10,6 +10,16 @@ module GdprAdmin
|
|
10
10
|
def skip_record!
|
11
11
|
raise SkipRecordError
|
12
12
|
end
|
13
|
+
|
14
|
+
def model_data_policy_class(model)
|
15
|
+
model = model.constantize if model.is_a?(String)
|
16
|
+
return model.data_policy_class if model.respond_to?(:data_policy_class)
|
17
|
+
|
18
|
+
prefix = model.data_policy_prefix if model.respond_to?(:data_policy_prefix)
|
19
|
+
"#{prefix}#{model}DataPolicy".constantize
|
20
|
+
rescue NameError
|
21
|
+
nil
|
22
|
+
end
|
13
23
|
end
|
14
24
|
end
|
15
25
|
end
|
@@ -29,7 +29,7 @@ module GdprAdmin
|
|
29
29
|
field_value = object[field_name]
|
30
30
|
next if field_value.nil?
|
31
31
|
|
32
|
-
new_value =
|
32
|
+
new_value = anonymize_field_value(version.item, field.merge(seed: field_value))
|
33
33
|
object.merge!(field_name => new_value)
|
34
34
|
end
|
35
35
|
object
|
@@ -32,13 +32,7 @@ module GdprAdmin
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def infer_data_policy_class(version)
|
35
|
-
|
36
|
-
return model.data_policy_class if model.respond_to?(:data_policy_class)
|
37
|
-
|
38
|
-
prefix = model.data_policy_prefix if model.respond_to?(:data_policy_prefix)
|
39
|
-
"#{prefix}#{version.item_type}DataPolicy".constantize
|
40
|
-
rescue NameError
|
41
|
-
nil
|
35
|
+
model_data_policy_class(version.item_type)
|
42
36
|
end
|
43
37
|
end
|
44
38
|
end
|
data/lib/gdpr_admin/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gdpr_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colex
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03
|
11
|
+
date: 2023-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|