consent 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,337 @@
1
+ PATH
2
+ remote: ../../rubocop-powerhome
3
+ specs:
4
+ rubocop-powerhome (0.5.3)
5
+ rubocop (= 1.66.1)
6
+ rubocop-performance
7
+ rubocop-rails
8
+ rubocop-rake
9
+ rubocop-rspec
10
+
11
+ PATH
12
+ remote: ..
13
+ specs:
14
+ consent (2.1.0)
15
+ cancancan (= 3.2.1)
16
+
17
+ GEM
18
+ remote: https://rubygems.org/
19
+ specs:
20
+ actioncable (7.1.3.2)
21
+ actionpack (= 7.1.3.2)
22
+ activesupport (= 7.1.3.2)
23
+ nio4r (~> 2.0)
24
+ websocket-driver (>= 0.6.1)
25
+ zeitwerk (~> 2.6)
26
+ actionmailbox (7.1.3.2)
27
+ actionpack (= 7.1.3.2)
28
+ activejob (= 7.1.3.2)
29
+ activerecord (= 7.1.3.2)
30
+ activestorage (= 7.1.3.2)
31
+ activesupport (= 7.1.3.2)
32
+ mail (>= 2.7.1)
33
+ net-imap
34
+ net-pop
35
+ net-smtp
36
+ actionmailer (7.1.3.2)
37
+ actionpack (= 7.1.3.2)
38
+ actionview (= 7.1.3.2)
39
+ activejob (= 7.1.3.2)
40
+ activesupport (= 7.1.3.2)
41
+ mail (~> 2.5, >= 2.5.4)
42
+ net-imap
43
+ net-pop
44
+ net-smtp
45
+ rails-dom-testing (~> 2.2)
46
+ actionpack (7.1.3.2)
47
+ actionview (= 7.1.3.2)
48
+ activesupport (= 7.1.3.2)
49
+ nokogiri (>= 1.8.5)
50
+ racc
51
+ rack (>= 2.2.4)
52
+ rack-session (>= 1.0.1)
53
+ rack-test (>= 0.6.3)
54
+ rails-dom-testing (~> 2.2)
55
+ rails-html-sanitizer (~> 1.6)
56
+ actiontext (7.1.3.2)
57
+ actionpack (= 7.1.3.2)
58
+ activerecord (= 7.1.3.2)
59
+ activestorage (= 7.1.3.2)
60
+ activesupport (= 7.1.3.2)
61
+ globalid (>= 0.6.0)
62
+ nokogiri (>= 1.8.5)
63
+ actionview (7.1.3.2)
64
+ activesupport (= 7.1.3.2)
65
+ builder (~> 3.1)
66
+ erubi (~> 1.11)
67
+ rails-dom-testing (~> 2.2)
68
+ rails-html-sanitizer (~> 1.6)
69
+ activejob (7.1.3.2)
70
+ activesupport (= 7.1.3.2)
71
+ globalid (>= 0.3.6)
72
+ activemodel (7.1.3.2)
73
+ activesupport (= 7.1.3.2)
74
+ activerecord (7.1.3.2)
75
+ activemodel (= 7.1.3.2)
76
+ activesupport (= 7.1.3.2)
77
+ timeout (>= 0.4.0)
78
+ activestorage (7.1.3.2)
79
+ actionpack (= 7.1.3.2)
80
+ activejob (= 7.1.3.2)
81
+ activerecord (= 7.1.3.2)
82
+ activesupport (= 7.1.3.2)
83
+ marcel (~> 1.0)
84
+ activesupport (7.1.3.2)
85
+ base64
86
+ bigdecimal
87
+ concurrent-ruby (~> 1.0, >= 1.0.2)
88
+ connection_pool (>= 2.2.5)
89
+ drb
90
+ i18n (>= 1.6, < 2)
91
+ minitest (>= 5.1)
92
+ mutex_m
93
+ tzinfo (~> 2.0)
94
+ appraisal (2.5.0)
95
+ bundler
96
+ rake
97
+ thor (>= 0.14.0)
98
+ ast (2.4.2)
99
+ base64 (0.2.0)
100
+ bigdecimal (3.1.9)
101
+ builder (3.3.0)
102
+ byebug (11.1.3)
103
+ cancancan (3.2.1)
104
+ coderay (1.1.3)
105
+ combustion (1.5.0)
106
+ activesupport (>= 3.0.0)
107
+ railties (>= 3.0.0)
108
+ thor (>= 0.14.6)
109
+ concurrent-ruby (1.3.5)
110
+ connection_pool (2.5.0)
111
+ crass (1.0.6)
112
+ csv (3.3.2)
113
+ date (3.4.1)
114
+ diff-lcs (1.6.0)
115
+ drb (2.2.1)
116
+ erubi (1.13.1)
117
+ globalid (1.2.1)
118
+ activesupport (>= 6.1)
119
+ i18n (1.14.7)
120
+ concurrent-ruby (~> 1.0)
121
+ io-console (0.8.0)
122
+ irb (1.15.1)
123
+ pp (>= 0.6.0)
124
+ rdoc (>= 4.0.0)
125
+ reline (>= 0.4.2)
126
+ json (2.10.1)
127
+ language_server-protocol (3.17.0.4)
128
+ license_finder (7.2.1)
129
+ bundler
130
+ csv (~> 3.2)
131
+ rubyzip (>= 1, < 3)
132
+ thor (~> 1.2)
133
+ tomlrb (>= 1.3, < 2.1)
134
+ with_env (= 1.1.0)
135
+ xml-simple (~> 1.1.9)
136
+ logger (1.6.6)
137
+ loofah (2.24.0)
138
+ crass (~> 1.0.2)
139
+ nokogiri (>= 1.12.0)
140
+ mail (2.8.1)
141
+ mini_mime (>= 0.1.1)
142
+ net-imap
143
+ net-pop
144
+ net-smtp
145
+ marcel (1.0.4)
146
+ method_source (1.1.0)
147
+ mini_mime (1.1.5)
148
+ minitest (5.25.4)
149
+ mutex_m (0.3.0)
150
+ net-imap (0.4.19)
151
+ date
152
+ net-protocol
153
+ net-pop (0.1.2)
154
+ net-protocol
155
+ net-protocol (0.2.2)
156
+ timeout
157
+ net-smtp (0.5.1)
158
+ net-protocol
159
+ nio4r (2.7.4)
160
+ nokogiri (1.17.2-aarch64-linux)
161
+ racc (~> 1.4)
162
+ nokogiri (1.17.2-arm-linux)
163
+ racc (~> 1.4)
164
+ nokogiri (1.17.2-arm64-darwin)
165
+ racc (~> 1.4)
166
+ nokogiri (1.17.2-x86_64-darwin)
167
+ racc (~> 1.4)
168
+ nokogiri (1.17.2-x86_64-linux)
169
+ racc (~> 1.4)
170
+ parallel (1.26.3)
171
+ parser (3.3.7.1)
172
+ ast (~> 2.4.1)
173
+ racc
174
+ pp (0.6.2)
175
+ prettyprint
176
+ prettyprint (0.2.0)
177
+ pry (0.14.2)
178
+ coderay (~> 1.1)
179
+ method_source (~> 1.0)
180
+ pry-byebug (3.10.1)
181
+ byebug (~> 11.0)
182
+ pry (>= 0.13, < 0.15)
183
+ psych (5.2.3)
184
+ date
185
+ stringio
186
+ racc (1.8.1)
187
+ rack (3.1.10)
188
+ rack-session (2.1.0)
189
+ base64 (>= 0.1.0)
190
+ rack (>= 3.0.0)
191
+ rack-test (2.2.0)
192
+ rack (>= 1.3)
193
+ rackup (2.2.1)
194
+ rack (>= 3)
195
+ rails (7.1.3.2)
196
+ actioncable (= 7.1.3.2)
197
+ actionmailbox (= 7.1.3.2)
198
+ actionmailer (= 7.1.3.2)
199
+ actionpack (= 7.1.3.2)
200
+ actiontext (= 7.1.3.2)
201
+ actionview (= 7.1.3.2)
202
+ activejob (= 7.1.3.2)
203
+ activemodel (= 7.1.3.2)
204
+ activerecord (= 7.1.3.2)
205
+ activestorage (= 7.1.3.2)
206
+ activesupport (= 7.1.3.2)
207
+ bundler (>= 1.15.0)
208
+ railties (= 7.1.3.2)
209
+ rails-dom-testing (2.2.0)
210
+ activesupport (>= 5.0.0)
211
+ minitest
212
+ nokogiri (>= 1.6)
213
+ rails-html-sanitizer (1.6.2)
214
+ loofah (~> 2.21)
215
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
216
+ railties (7.1.3.2)
217
+ actionpack (= 7.1.3.2)
218
+ activesupport (= 7.1.3.2)
219
+ irb
220
+ rackup (>= 1.0.0)
221
+ rake (>= 12.2)
222
+ thor (~> 1.0, >= 1.2.2)
223
+ zeitwerk (~> 2.6)
224
+ rainbow (3.1.1)
225
+ rake (13.2.1)
226
+ rdoc (6.12.0)
227
+ psych (>= 4.0.0)
228
+ regexp_parser (2.10.0)
229
+ reline (0.6.0)
230
+ io-console (~> 0.5)
231
+ rexml (3.4.1)
232
+ rspec (3.13.0)
233
+ rspec-core (~> 3.13.0)
234
+ rspec-expectations (~> 3.13.0)
235
+ rspec-mocks (~> 3.13.0)
236
+ rspec-core (3.13.3)
237
+ rspec-support (~> 3.13.0)
238
+ rspec-expectations (3.13.3)
239
+ diff-lcs (>= 1.2.0, < 2.0)
240
+ rspec-support (~> 3.13.0)
241
+ rspec-mocks (3.13.2)
242
+ diff-lcs (>= 1.2.0, < 2.0)
243
+ rspec-support (~> 3.13.0)
244
+ rspec-rails (6.1.5)
245
+ actionpack (>= 6.1)
246
+ activesupport (>= 6.1)
247
+ railties (>= 6.1)
248
+ rspec-core (~> 3.13)
249
+ rspec-expectations (~> 3.13)
250
+ rspec-mocks (~> 3.13)
251
+ rspec-support (~> 3.13)
252
+ rspec-support (3.13.2)
253
+ rubocop (1.66.1)
254
+ json (~> 2.3)
255
+ language_server-protocol (>= 3.17.0)
256
+ parallel (~> 1.10)
257
+ parser (>= 3.3.0.2)
258
+ rainbow (>= 2.2.2, < 4.0)
259
+ regexp_parser (>= 2.4, < 3.0)
260
+ rubocop-ast (>= 1.32.2, < 2.0)
261
+ ruby-progressbar (~> 1.7)
262
+ unicode-display_width (>= 2.4.0, < 3.0)
263
+ rubocop-ast (1.38.0)
264
+ parser (>= 3.3.1.0)
265
+ rubocop-performance (1.23.1)
266
+ rubocop (>= 1.48.1, < 2.0)
267
+ rubocop-ast (>= 1.31.1, < 2.0)
268
+ rubocop-rails (2.29.1)
269
+ activesupport (>= 4.2.0)
270
+ rack (>= 1.1)
271
+ rubocop (>= 1.52.0, < 2.0)
272
+ rubocop-ast (>= 1.31.1, < 2.0)
273
+ rubocop-rake (0.6.0)
274
+ rubocop (~> 1.0)
275
+ rubocop-rspec (3.4.0)
276
+ rubocop (~> 1.61)
277
+ ruby-progressbar (1.13.0)
278
+ rubyzip (2.4.1)
279
+ sqlite3 (1.7.3-aarch64-linux)
280
+ sqlite3 (1.7.3-arm-linux)
281
+ sqlite3 (1.7.3-arm64-darwin)
282
+ sqlite3 (1.7.3-x86_64-darwin)
283
+ sqlite3 (1.7.3-x86_64-linux)
284
+ stringio (3.1.3)
285
+ thor (1.3.2)
286
+ timeout (0.4.3)
287
+ tomlrb (2.0.3)
288
+ tzinfo (2.0.6)
289
+ concurrent-ruby (~> 1.0)
290
+ unicode-display_width (2.6.0)
291
+ websocket-driver (0.7.7)
292
+ base64
293
+ websocket-extensions (>= 0.1.0)
294
+ websocket-extensions (0.1.5)
295
+ with_env (1.1.0)
296
+ xml-simple (1.1.9)
297
+ rexml
298
+ zeitwerk (2.6.18)
299
+
300
+ PLATFORMS
301
+ aarch64-linux
302
+ aarch64-linux-gnu
303
+ aarch64-linux-musl
304
+ arm-linux
305
+ arm-linux-gnu
306
+ arm-linux-musl
307
+ arm64-darwin
308
+ x86_64-darwin
309
+ x86_64-linux
310
+ x86_64-linux-gnu
311
+ x86_64-linux-musl
312
+
313
+ DEPENDENCIES
314
+ activerecord (>= 5)
315
+ appraisal (~> 2.5.0)
316
+ base64
317
+ bigdecimal
318
+ bundler (~> 2.1)
319
+ combustion (~> 1.3)
320
+ consent!
321
+ license_finder (>= 7.0)
322
+ logger
323
+ mutex_m
324
+ net-imap (< 0.5.0)
325
+ nokogiri (< 1.18)
326
+ pry (>= 0.14.2)
327
+ pry-byebug (= 3.10.1)
328
+ rails (= 7.1.3.2)
329
+ rake (~> 13)
330
+ rspec (~> 3.0)
331
+ rspec-rails (~> 6.1.5)
332
+ rubocop-powerhome!
333
+ sqlite3 (~> 1.7.3)
334
+ zeitwerk (< 2.7.0)
335
+
336
+ BUNDLED WITH
337
+ 2.5.23
@@ -110,7 +110,7 @@ module Consent
110
110
  # For more info, check the documentation of [CanCan::Ability]
111
111
  def can?(action_or_pair, subject = nil, *args)
112
112
  action, subject = extract_action_subject(action_or_pair, subject)
113
- super action, subject, *args
113
+ super(action, subject, *args)
114
114
  end
115
115
 
116
116
  # @private
data/lib/consent/dsl.rb CHANGED
@@ -14,14 +14,6 @@ module Consent
14
14
  DSL.build(@subject, @defaults.merge(new_defaults), &block)
15
15
  end
16
16
 
17
- # rubocop:disable Lint/UnusedBlockArgument, Security/Eval
18
- def eval_view(key, label, collection_conditions)
19
- view key, label do |user|
20
- eval(collection_conditions)
21
- end
22
- end
23
- # rubocop:enable Lint/UnusedBlockArgument, Security/Eval
24
-
25
17
  def view(key, label, instance = nil, collection = nil, &block)
26
18
  collection ||= block
27
19
  @subject.views[key] = View.new(key, label, instance, collection)
@@ -50,7 +50,7 @@ module Consent
50
50
 
51
51
  def failure_message_base(failure) # rubocop:disable Metrics/MethodLength
52
52
  message = format(
53
- 'expected %<skey>s (%<sclass>s) %<fail>s provide view %<view>s with`\
53
+ 'expected %<skey>s (%<sclass>s) %<fail>s provide view %<view>s with`
54
54
  `%<conditions>p, but',
55
55
  skey: @subject_key.to_s, sclass: @subject_key.class,
56
56
  view: @view_key, conditions: @conditions, fail: failure
@@ -63,8 +63,7 @@ module Consent
63
63
  )
64
64
  else
65
65
  actual_views = Consent.find_subjects(@subject_key)
66
- .map(&:views)
67
- .map(&:keys).flatten
66
+ .flat_map { |subject| subject.views.keys }
68
67
  format(
69
68
  "%<message>s available views are %<views>p",
70
69
  message: message, views: actual_views
@@ -3,6 +3,16 @@
3
3
  module Consent
4
4
  # Coder for ability subjects
5
5
  module SubjectCoder
6
+ module Model
7
+ def self.included(base)
8
+ if Gem::Version.new(Rails.version) >= Gem::Version.new("7.1")
9
+ base.serialize :subject, coder: Consent::SubjectCoder
10
+ else
11
+ base.serialize :subject, Consent::SubjectCoder
12
+ end
13
+ end
14
+ end
15
+
6
16
  module_function
7
17
 
8
18
  # Loads the serialized key (snake case string) as a valid
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Consent
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
data/mkdocs.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  site_name: Consent
2
2
  nav:
3
3
  - "Home": "README.md"
4
+ - "Changelog": "CHANGELOG.md"
4
5
  plugins:
5
6
  - techdocs-core
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consent
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Palhares
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-02 00:00:00.000000000 Z
11
+ date: 2025-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cancancan
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: appraisal
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.5.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.5.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +94,34 @@ dependencies:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '7.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 0.14.2
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 0.14.2
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: pry-byebug
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
115
  - - '='
88
116
  - !ruby/object:Gem::Version
89
- version: 3.9.0
117
+ version: 3.10.1
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
122
  - - '='
95
123
  - !ruby/object:Gem::Version
96
- version: 3.9.0
124
+ version: 3.10.1
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: rake
99
127
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +156,14 @@ dependencies:
128
156
  requirements:
129
157
  - - "~>"
130
158
  - !ruby/object:Gem::Version
131
- version: 5.1.2
159
+ version: 6.1.5
132
160
  type: :development
133
161
  prerelease: false
134
162
  version_requirements: !ruby/object:Gem::Requirement
135
163
  requirements:
136
164
  - - "~>"
137
165
  - !ruby/object:Gem::Version
138
- version: 5.1.2
166
+ version: 6.1.5
139
167
  - !ruby/object:Gem::Dependency
140
168
  name: rubocop-powerhome
141
169
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +184,14 @@ dependencies:
156
184
  requirements:
157
185
  - - "~>"
158
186
  - !ruby/object:Gem::Version
159
- version: 1.4.2
187
+ version: 1.7.3
160
188
  type: :development
161
189
  prerelease: false
162
190
  version_requirements: !ruby/object:Gem::Requirement
163
191
  requirements:
164
192
  - - "~>"
165
193
  - !ruby/object:Gem::Version
166
- version: 1.4.2
194
+ version: 1.7.3
167
195
  description: Consent permission based authorization
168
196
  email:
169
197
  - chjunior@gmail.com
@@ -174,7 +202,9 @@ files:
174
202
  - ".gitignore"
175
203
  - ".rubocop.yml"
176
204
  - ".rubocop_todo.yml"
205
+ - Appraisals
177
206
  - Gemfile
207
+ - Gemfile.lock
178
208
  - Rakefile
179
209
  - app/models/concerns/consent/authorizable.rb
180
210
  - app/models/consent/application_record.rb
@@ -189,6 +219,13 @@ files:
189
219
  - doc/dependency_decisions.yml
190
220
  - docs/CHANGELOG.md
191
221
  - docs/README.md
222
+ - gemfiles/.bundle/config
223
+ - gemfiles/rails_6_1.gemfile
224
+ - gemfiles/rails_6_1.gemfile.lock
225
+ - gemfiles/rails_7_0.gemfile
226
+ - gemfiles/rails_7_0.gemfile.lock
227
+ - gemfiles/rails_7_1.gemfile
228
+ - gemfiles/rails_7_1.gemfile.lock
192
229
  - lib/consent.rb
193
230
  - lib/consent/ability.rb
194
231
  - lib/consent/action.rb
@@ -215,7 +252,7 @@ licenses:
215
252
  - MIT
216
253
  metadata:
217
254
  rubygems_mfa_required: 'true'
218
- post_install_message:
255
+ post_install_message:
219
256
  rdoc_options: []
220
257
  require_paths:
221
258
  - lib
@@ -223,15 +260,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
223
260
  requirements:
224
261
  - - ">="
225
262
  - !ruby/object:Gem::Version
226
- version: '2.7'
263
+ version: '3.0'
227
264
  required_rubygems_version: !ruby/object:Gem::Requirement
228
265
  requirements:
229
266
  - - ">="
230
267
  - !ruby/object:Gem::Version
231
268
  version: '0'
232
269
  requirements: []
233
- rubygems_version: 3.3.7
234
- signing_key:
270
+ rubygems_version: 3.5.23
271
+ signing_key:
235
272
  specification_version: 4
236
273
  summary: Consent permission based authorization
237
274
  test_files: []