gdpr_admin 1.8.0 → 1.9.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: eb44596fd7f9b9e3b3296e45d1c3737980a0f6c2d8b910a7d04e72426008ccc6
4
- data.tar.gz: c188e1f3129d26d20f194e3081ea2fd4676262250ca791ab702cf3d6f0514240
3
+ metadata.gz: 9f2e3eb2d8eea4c910112fa0ca7c4fd4ac77816137321022205684a583086315
4
+ data.tar.gz: 9ac8e526d9a38a54a88557a58cee645aa0a80aa2362fe01dfbd41f719440ae67
5
5
  SHA512:
6
- metadata.gz: 44e6d8532f3cde2e673c5395982d7a9f7d8bcc5cc99337e2a595cf095a95c9102316a6c0489318f86d05abd8c72dff73136c91e6ed3c94a9316ae461c5d1e77b
7
- data.tar.gz: f91dae933610884e3686ab04cc66d31645447a6f16e3960149f3791f081c448b3b42503abbb1e593995c5c66c2a8df36c2606eb723974e3d2abbdeeb2fc6cd88
6
+ metadata.gz: d320fa119e9adecadce0703e19655a8267e11b159a8f5da6854fa939cc2c6002c0290b12b4f1729f21cbcfe82de098e540156165358b925ae6133c9ae11350e8
7
+ data.tar.gz: f4ef6c026b32d33c9f05bd0dca8b1ec2ded1b66f22e7f477a874418bf4dbefac918c4ec3926e96cf483ff3fe19be12274a15791e994c6310928f2223c5727dbf
data/README.md CHANGED
@@ -382,6 +382,15 @@ GdprAdmin.configure do |config|
382
382
  end
383
383
  ```
384
384
 
385
+ #### Rollback on Failure
386
+ By default, GDPR Admin will attempt to rollback all changes made during the processing a Request in case it fails during the processing. This can be turned of with the flag `rollback_on_failure`. In this situation, all changes will be committed as soon as they are done.
387
+
388
+ ```ruby
389
+ GdprAdmin.configure do |config|
390
+ config.rollback_on_failure = false
391
+ end
392
+ ```
393
+
385
394
  ### Jobs
386
395
  Requests are processed asynchronously using ActiveJob.
387
396
 
@@ -41,8 +41,8 @@ module GdprAdmin
41
41
 
42
42
  def process!
43
43
  GdprAdmin.load_data_policies
44
- reload.with_lock { processing! }
45
- with_lock do
44
+ reload.lock_strategy { processing! }
45
+ lock_strategy do
46
46
  process_policies
47
47
  completed!
48
48
  end
@@ -67,6 +67,13 @@ module GdprAdmin
67
67
  RequestProcessorJob.set(wait: grace_period).perform_later(self)
68
68
  end
69
69
 
70
+ def lock_strategy(&block)
71
+ return with_lock(&block) if GdprAdmin.config.rollback_on_failure
72
+ return with_advisory_lock(to_global_id.to_s, &block) if respond_to?(:with_advisory_lock)
73
+
74
+ yield
75
+ end
76
+
70
77
  private
71
78
 
72
79
  def grace_period
@@ -20,6 +20,8 @@ module GdprAdmin
20
20
  return addr.mask(24).to_s if addr.ipv4?
21
21
 
22
22
  addr.mask(48).to_s
23
+ rescue IPAddr::InvalidAddressError
24
+ value
23
25
  end
24
26
  end
25
27
  end
@@ -3,7 +3,7 @@
3
3
  module GdprAdmin
4
4
  class Configuration
5
5
  attr_accessor :tenant_class, :data_policies_path, :default_job_queue,
6
- :erasure_grace_period, :export_grace_period
6
+ :erasure_grace_period, :export_grace_period, :rollback_on_failure
7
7
  attr_writer :tenant_adapter
8
8
 
9
9
  def initialize
@@ -13,6 +13,7 @@ module GdprAdmin
13
13
  @default_job_queue = :default
14
14
  @erasure_grace_period = 4.hours
15
15
  @export_grace_period = nil
16
+ @rollback_on_failure = true
16
17
  end
17
18
 
18
19
  def tenant_adapter
@@ -2,6 +2,6 @@
2
2
 
3
3
  # :nocov:
4
4
  module GdprAdmin
5
- VERSION = '1.8.0'
5
+ VERSION = '1.9.0'
6
6
  end
7
7
  # :nocov:
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.8.0
4
+ version: 1.9.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-09-26 00:00:00.000000000 Z
11
+ date: 2024-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails