gdpr_rails 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/models/policy_manager/concerns/user_behavior.rb +10 -2
- data/lib/policy_manager/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f3bd8d4a83a8def6219e0f1133cdc0f5a072ce6
|
4
|
+
data.tar.gz: c2678088ad8a2945e0836a20719778de1693dc7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
|
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
|
-
|
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
|
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.
|
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-
|
12
|
+
date: 2018-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|