gdpr_rails 0.2.2 → 0.2.4

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
  SHA1:
3
- metadata.gz: 6181a2509e31b54aae04f5200f9379312f252826
4
- data.tar.gz: 8368d29d88f66c2829cf21f3818bbffb3bc0010e
3
+ metadata.gz: 6f3bd8d4a83a8def6219e0f1133cdc0f5a072ce6
4
+ data.tar.gz: c2678088ad8a2945e0836a20719778de1693dc7e
5
5
  SHA512:
6
- metadata.gz: 6a64af678175901f4d3557512b6f6c6f714a28aea94339dcbf749039f2f28c0a95fab855e654caf8b7ff34bb6e5172d1ff55d84033e9931decdeed15f586a7dd
7
- data.tar.gz: 14be1400c6c09ef867262e9bed12d286072a9774c95067c42b880e870cb759c8ebd6ee3e81c0a0c075d6db7c80fc5f604ad19cb47946fe4d13c2ad301ad6ed94
6
+ metadata.gz: 40d2cb1dbe0646fdd9193f034f06b71cac780e7e4b336fd054cf1441a8b317c6e3eb5d9dbb709a5006717acf1b19df4828c756a489b90a60cc2a81417ca51f5d
7
+ data.tar.gz: d95f5add634525882da0543931adbcb15e6b77fb172ed194481b650a73dd37a173da16ae0e23027d2e6e720b6f1a7cc7c58f3663e2727d13fe27fd473db8f5d9
data/README.md CHANGED
@@ -134,7 +134,7 @@ When the policies are configured will generate some helper methods on User model
134
134
 
135
135
  **Use this in your controller:**
136
136
  ```ruby
137
- @user.store_policy_cookie if cookies["policy_rule_cookie"] == "accepted"
137
+ @user.accept_policy_from("your_cookie") if cookies["policy_rule_your_cookie"] == "accepted"
138
138
  ```
139
139
  + **validates_on:** will require users validation, will automagically create virtual attributes for the policy you set, so, if you set `age` in your config you must supply in your forms a `policy_rule_age` checkbox in your form, if you don't supply those then the user validation will return errors on `policy_rule_age` . Don't forget to add the fields in your strong params in the controller which handles the request.
140
140
  + **if:** you can add conditions as a Proc in order skip validations:
@@ -87,14 +87,14 @@ module PolicyManager::Concerns::UserBehavior
87
87
  end
88
88
 
89
89
  def confirm_all_policies!
90
- peding_policies.each do |c|
90
+ pending_policies.each do |c|
91
91
  term = c.terms.last
92
92
  current_user.handle_policy_for(term).accept!
93
93
  end
94
94
  end
95
95
 
96
96
  def reject_all_policies!
97
- peding_policies.each do |c|
97
+ pending_policies.each do |c|
98
98
  term = c.terms.last
99
99
  current_user.handle_policy_for(term).reject!
100
100
  end
@@ -130,4 +130,12 @@ module PolicyManager::Concerns::UserBehavior
130
130
  self.portability_requests.select{|p| p.pending? || p.progress?}.blank?
131
131
  end
132
132
 
133
+ def accept_policy_from(name)
134
+ term = PolicyManager::Config.rules.find{|o| o.name == name}.terms.published.last
135
+ if term.present?
136
+ user_term = self.handle_policy_for(term)
137
+ user_term.accept! unless user_term.accepted?
138
+ end
139
+ end
140
+
133
141
  end
@@ -1,3 +1,3 @@
1
1
  module PolicyManager
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdpr_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Michelson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-07 00:00:00.000000000 Z
12
+ date: 2018-05-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails