gdpr_admin 1.2.0 → 1.3.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: b019a3a76e13bb0a29a264a2f14aa9979c8a4cf2ef3163014f72f727856d07ca
4
- data.tar.gz: 735b7ac163d0b9a7579f0bb9c26bde48ca2dc5e00996175a31aaa597dae94597
3
+ metadata.gz: 9b5cc14d1e0f88e99bec3ccd100795cc1985ef86fa559fbdd2639bdd5bef1ee4
4
+ data.tar.gz: 5c07836dec53a6265e3fcd6516f910a22b6834234bea5f39890030ba394d0e5c
5
5
  SHA512:
6
- metadata.gz: 14e0c4a02403085c3c1fd5f7b29625f0b8194ab41a374e0f58213aa59f27e5b7e8a4d9477cbb53975fcd331af9d20516cfd3a37ffa6cc6007579ddd72bbba5a7
7
- data.tar.gz: 63d3e8710805b8f339da69a4e93deb501d6bc7734eb21f542c3ca15683114e6c8b57e73d762a2e77294c9b3522e3eb35e5aa79d960a9bf5d6c6ce68081124c4e
6
+ metadata.gz: f4552232540bf1153c32e15ccc1ec0ed5f5a399649bd5618ded36476881124d2496a1f345deec8f5baf98ecba1ff4e0161743ca905abae45761024d9c68432e0
7
+ data.tar.gz: 8169ff0b5040484ceac0084601246d19d875e222509ec2f1a2dab055822d79db13b999c6a96468167cf39adfe5cc26b0aff60b9c046bbcc31422177e2ca66684
data/README.md CHANGED
@@ -6,12 +6,17 @@
6
6
 
7
7
  [![Build Status](https://github.com/Colex/gdpr_admin/actions/workflows/build.yml/badge.svg)](https://github.com/Colex/gdpr_admin/actions/workflows/build.yml)
8
8
  [![Code Climate](https://codeclimate.com/github/Colex/gdpr_admin.svg)](https://codeclimate.com/github/Colex/gdpr_admin)
9
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/00740133ef1f97181ed6/test_coverage)](https://codeclimate.com/github/Colex/gdpr_admin/test_coverage)
9
10
  [![Gem Version](https://badge.fury.io/rb/gdpr_admin.svg)](http://badge.fury.io/rb/gdpr_admin)
10
11
 
11
12
  Rails engine for processing GDPR processes. GDPR Admin offers a simple interface for defining strategies for automating the process of data access and data removal as required by data privacy regulations like GDPR.
12
13
 
13
14
  GDPR Admin uses simple Ruby classes, so you're free to code your Data Policies as you see fit. A swiss knife of
14
- helper methods are available to make the processes even simpler.
15
+ helper methods are available to make the processes even simpler. The focus of the gem is to easily implement:
16
+
17
+ - [Right of access](https://ico.org.uk/for-organisations/guide-to-data-protection/guide-to-the-general-data-protection-regulation-gdpr/individual-rights/right-of-access/): export a subject's data on request;
18
+ - [Right to erasure](https://ico.org.uk/for-organisations/guide-to-data-protection/guide-to-the-general-data-protection-regulation-gdpr/individual-rights/right-to-erasure/): remove a subject's personal data on request;
19
+ - [Storage limitation](https://ico.org.uk/for-organisations/guide-to-data-protection/guide-to-the-general-data-protection-regulation-gdpr/principles/storage-limitation/): hold data for as long as required (data retention policies and offboarding tenants);
15
20
 
16
21
  ## Installation
17
22
  Add this line to your application's Gemfile:
@@ -67,6 +72,26 @@ GdprAdmin::Request.create!(
67
72
 
68
73
  Creating a request will automatically enqueue the request to be processed in 4 hours - this gives time to cancel an accidental request. You can configure this grace period as desired.
69
74
 
75
+ ### Scope Helpers
76
+ Helpers to be used within the `#scope` method.
77
+
78
+ #### `scope_by_date`
79
+
80
+ ```ruby
81
+ scope_by_date(scope, field = :updated_at)
82
+ ```
83
+
84
+ Automatically scopes the data using the `updated_at` column to match the GDPR Request. You can use a different column by providing
85
+ a second argument.
86
+
87
+ ```ruby
88
+ class ContactDataPolicy < GdprAdmin::ApplicationDataPolicy
89
+ def scope
90
+ scope_by_date(Contact)
91
+ end
92
+ end
93
+ ```
94
+
70
95
  ### Anonymization Helpers
71
96
  A set of helper methods are available to make the anonymization even simpler. These are not mandatory, but can help you
72
97
  keep your code cleaner and, better, write less code.
@@ -155,9 +180,9 @@ You can define a repeating job with `sidekiq-cron`:
155
180
 
156
181
  ```ruby
157
182
  Sidekiq::Cron::Job.create(
158
- class: SyncOrganizationsContactsJob.to_s,
183
+ class: 'GdprAdmin::DataRetentionPoliciesRunnerJob',
159
184
  cron: '0 2 * * *',
160
- name: 'Sync Organization Contacts',
185
+ name: 'Run Data Retention Policies',
161
186
  queue: 'cron',
162
187
  active_job: true,
163
188
  )
@@ -3,6 +3,7 @@
3
3
  module GdprAdmin
4
4
  class ApplicationDataPolicy
5
5
  include Helpers::EraseHelper
6
+ include Helpers::ScopeHelper
6
7
 
7
8
  def initialize(request)
8
9
  @request = request
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GdprAdmin
4
+ module Helpers
5
+ module ScopeHelper
6
+ def scope_by_date(scope, field = :updated_at)
7
+ scope.where(field => ...request.data_older_than)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  # :nocov:
4
4
  module GdprAdmin
5
- VERSION = '1.2.0'
5
+ VERSION = '1.3.0'
6
6
  end
7
7
  # :nocov:
data/lib/gdpr_admin.rb CHANGED
@@ -7,6 +7,7 @@ require 'gdpr_admin/error'
7
7
  require 'gdpr_admin/invalid_status_error'
8
8
  require 'gdpr_admin/skip_data_policy_error'
9
9
  require 'gdpr_admin/helpers/erase_helper'
10
+ require 'gdpr_admin/helpers/scope_helper'
10
11
  require 'gdpr_admin/application_data_policy'
11
12
  require 'gdpr_admin/paper_trail/version_data_policy'
12
13
  require 'gdpr_admin/tenant_adapters/acts_as_tenant_adapter'
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.2.0
4
+ version: 1.3.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-02-16 00:00:00.000000000 Z
11
+ date: 2023-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -168,6 +168,7 @@ files:
168
168
  - lib/gdpr_admin/helpers/erase_helper.rb
169
169
  - lib/gdpr_admin/helpers/field_anonymizer_helper.rb
170
170
  - lib/gdpr_admin/helpers/paper_trail_helper.rb
171
+ - lib/gdpr_admin/helpers/scope_helper.rb
171
172
  - lib/gdpr_admin/invalid_status_error.rb
172
173
  - lib/gdpr_admin/paper_trail/version_data_policy.rb
173
174
  - lib/gdpr_admin/skip_data_policy_error.rb