gdpr_admin 1.4.2 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ededdaffe816cd8865d4b958ded108be6e869b8166ca655646dc437d93526c5
|
4
|
+
data.tar.gz: 17de7a32993d5f12ba4b872fc2a7aee9d64c225ec727295f2de62c9078b0fe85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8560a167bcb6757c42c2b29c265faed9ea615f99dda3fbadaa25d5cd411a78400888a0ba057e2af4e7846b811780c41ca025606e5a4c78aed6c319fae3412733
|
7
|
+
data.tar.gz: e1ad8a3871d80f2e052c39db3e14acaf0315a40619d742c242e0fed870d336e70f2d3573f6ebccacec19632d25046b322d270af3fa612ce1630a86083e2baeab
|
data/README.md
CHANGED
@@ -47,12 +47,20 @@ Implement the methods `#scope`, `#export` and `#erase` for the new data policy.
|
|
47
47
|
able to access the `GdprAdmin::Request` object in any method by calling the method `request` - you can, therefore, have
|
48
48
|
different scopes and different removal behaviors depending on the request.
|
49
49
|
|
50
|
+
Optinally, you may declare a `#subject_scope` method with logic for scoping subject data. If this method is not present,
|
51
|
+
it will fallback to the `#scope` method.
|
52
|
+
|
50
53
|
```ruby
|
51
54
|
class UserDataPolicy < GdprAdmin::ApplicationDataPolicy
|
52
55
|
def scope
|
53
56
|
User.with_deleted.where(updated_at: ...request.data_older_than)
|
54
57
|
end
|
55
58
|
|
59
|
+
# Optional
|
60
|
+
def subject_scope
|
61
|
+
scope.where(email: request.subject)
|
62
|
+
end
|
63
|
+
|
56
64
|
def erase(user)
|
57
65
|
user.update_columns(
|
58
66
|
first_name: 'Anonymous',
|
@@ -29,20 +29,26 @@ module GdprAdmin
|
|
29
29
|
after_create_commit :schedule_processing
|
30
30
|
|
31
31
|
validates :status, presence: true
|
32
|
+
validates :subject, presence: true, if: :subject_request?
|
33
|
+
validates :subject, absence: true, unless: :subject_request?
|
32
34
|
validate :valid_status_transition?
|
33
35
|
|
34
36
|
def process!
|
35
37
|
GdprAdmin.load_data_policies
|
36
|
-
with_lock { processing! }
|
38
|
+
reload.with_lock { processing! }
|
37
39
|
with_lock do
|
38
40
|
process_policies
|
39
41
|
completed!
|
40
42
|
end
|
41
43
|
rescue StandardError
|
42
|
-
|
44
|
+
failed!
|
43
45
|
raise
|
44
46
|
end
|
45
47
|
|
48
|
+
def subject_request?
|
49
|
+
export_subject? || erase_subject?
|
50
|
+
end
|
51
|
+
|
46
52
|
def erase?
|
47
53
|
erase_data? || erase_subject?
|
48
54
|
end
|
@@ -43,14 +43,14 @@ module GdprAdmin
|
|
43
43
|
def process
|
44
44
|
GdprAdmin.config.tenant_adapter.with_tenant(request.tenant) do
|
45
45
|
run_preprocessors
|
46
|
-
process_scope
|
46
|
+
process_scope
|
47
47
|
rescue SkipDataPolicyError
|
48
48
|
nil
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
def process_scope
|
53
|
-
|
52
|
+
def process_scope
|
53
|
+
policy_scope.find_each do |record|
|
54
54
|
process_record(record)
|
55
55
|
end
|
56
56
|
end
|
@@ -59,6 +59,12 @@ module GdprAdmin
|
|
59
59
|
|
60
60
|
attr_reader :request
|
61
61
|
|
62
|
+
def policy_scope
|
63
|
+
return subject_scope if request.subject_request? && respond_to?(:subject_scope)
|
64
|
+
|
65
|
+
scope
|
66
|
+
end
|
67
|
+
|
62
68
|
def process_record(record)
|
63
69
|
run_record_preprocessors(record)
|
64
70
|
export(record) if request.export?
|
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
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colex
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- config/routes.rb
|
157
157
|
- db/migrate/20230212185817_create_gdpr_admin_requests.rb
|
158
158
|
- db/migrate/20230216171202_create_gdpr_admin_data_retention_policies.rb
|
159
|
+
- db/migrate/20230417104258_add_subject_to_gdpr_admin_requests.rb
|
159
160
|
- lib/gdpr_admin.rb
|
160
161
|
- lib/gdpr_admin/anonymizers/company_anonymizer.rb
|
161
162
|
- lib/gdpr_admin/anonymizers/contact_anonymizer.rb
|