consent 2.2.0 → 2.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32f3bcb4617c05a326d76f7648a670a18500f07291f047edaddcb17f3e7999e1
4
- data.tar.gz: 8b85e9ecc63cd83eaeabcf70f9db022725a1e2c4e982196f14d714340de6c7ce
3
+ metadata.gz: 9b93a2b46698ef7ba24642972b3c255ece007f5a2184a51b540bf30d9008586a
4
+ data.tar.gz: 4133a6cfa57b200b5e9c238d979ec7e21c8e0d35a2991a1a0a4c0b7bef71a977
5
5
  SHA512:
6
- metadata.gz: 7f61f0aa61b8ee3cc4da4c9e7baf0c7032f18e1b2b00ad4592b18dea04c12d5dfa3522971a7fc93ea52138075d21cd0ecf1647e18b2b7ede38c2ff40333fa508
7
- data.tar.gz: 7b2bbb5226cf584a5b0e08ee3aeead88c0440afba2ea5ac2357b311029eb06979b39c41a02bfc894df36a1480b469895cb078434b4710e06b6ee04a89f692eb9
6
+ metadata.gz: a83602c37d57879260c1a13157bb65209c606826187e44ef4764a86497bee2a27ab0088d1b7c082de1fc95d34c225481a06967ec3d56f2344280edf6b248f777
7
+ data.tar.gz: 9267bfa0bcf4575dc7080bb275ca3f9515c5d2d55568244bdd66aa9fd21720e3fcdb44ce9ef1d11f08bde3f7c1bec4ca0a402b9d086784d553aa1acf12c4234e
data/.rubocop.yml CHANGED
@@ -6,13 +6,5 @@ require:
6
6
  AllCops:
7
7
  TargetRubyVersion: 3.0
8
8
 
9
- Style/FrozenStringLiteralComment:
10
- Exclude:
11
- - 'gemfiles/*'
12
-
13
- Bundler/OrderedGems:
14
- Exclude:
15
- - 'gemfiles/*'
16
-
17
9
  Rails:
18
10
  Enabled: false
data/Gemfile CHANGED
@@ -5,13 +5,15 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in consent.gemspec
6
6
  gemspec
7
7
 
8
- gem "base64"
9
- gem "bigdecimal"
10
- gem "erb", "< 5.0" # Hold erb to support Ruby < 3.2
11
- gem "logger"
12
- gem "mutex_m"
8
+ gem "base64", "~> 0.3.0" # Hold base64 to support Ruby 3.0
9
+ gem "bigdecimal", "~> 3.2.0", "< 3.2.3" # Hold bigdecimal to support Ruby 3.0
10
+ gem "connection_pool", "~> 2.4.1" # Hold connection_pool to support Ruby 3.0 (2.5.3 requires Ruby 3.1+)
11
+ gem "erb", "~> 4.0.4" # Hold erb to support Ruby 3.0
12
+ gem "logger", "~> 1.7.0" # Hold logger to support Ruby 3.0
13
+ gem "minitest", "~> 5.25.5" # Hold minitest to support Ruby 3.0
14
+ gem "mutex_m", "~> 0.3.0" # Hold mutex_m to support Ruby 3.0
13
15
  gem "net-imap", "< 0.5.0"
14
- gem "nokogiri", "< 1.18"
16
+ gem "nokogiri", "~> 1.17.0", "< 1.18" # Hold nokogiri to support Ruby 3.0
15
17
  gem "rubocop-powerhome", path: "../rubocop-powerhome"
16
18
  gem "securerandom", "< 0.4" # Hold securerandom to support Ruby 3.0
17
19
  gem "zeitwerk", "< 2.7.0"
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ../rubocop-powerhome
3
3
  specs:
4
- rubocop-powerhome (0.5.5)
5
- rubocop (= 1.74.0)
4
+ rubocop-powerhome (0.6.0)
5
+ rubocop (= 1.82.1)
6
6
  rubocop-performance
7
7
  rubocop-rails
8
8
  rubocop-rake
@@ -11,7 +11,7 @@ PATH
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- consent (2.2.0)
14
+ consent (2.4.0)
15
15
  cancancan (= 3.2.1)
16
16
 
17
17
  GEM
@@ -63,14 +63,14 @@ GEM
63
63
  builder (3.3.0)
64
64
  byebug (11.1.3)
65
65
  cancancan (3.2.1)
66
- cgi (0.5.0)
66
+ cgi (0.5.1)
67
67
  coderay (1.1.3)
68
68
  combustion (1.5.0)
69
69
  activesupport (>= 3.0.0)
70
70
  railties (>= 3.0.0)
71
71
  thor (>= 0.14.6)
72
72
  concurrent-ruby (1.3.5)
73
- connection_pool (2.5.3)
73
+ connection_pool (2.4.1)
74
74
  crass (1.0.6)
75
75
  csv (3.3.5)
76
76
  date (3.4.1)
@@ -159,7 +159,7 @@ GEM
159
159
  thor (~> 1.0, >= 1.2.2)
160
160
  zeitwerk (~> 2.6)
161
161
  rainbow (3.1.1)
162
- rake (13.3.0)
162
+ rake (13.3.1)
163
163
  rdoc (6.14.2)
164
164
  erb
165
165
  psych (>= 4.0.0)
@@ -188,7 +188,7 @@ GEM
188
188
  rspec-mocks (~> 3.13)
189
189
  rspec-support (~> 3.13)
190
190
  rspec-support (3.13.4)
191
- rubocop (1.74.0)
191
+ rubocop (1.82.1)
192
192
  json (~> 2.3)
193
193
  language_server-protocol (~> 3.17.0.2)
194
194
  lint_roller (~> 1.1.0)
@@ -196,10 +196,10 @@ GEM
196
196
  parser (>= 3.3.0.2)
197
197
  rainbow (>= 2.2.2, < 4.0)
198
198
  regexp_parser (>= 2.9.3, < 3.0)
199
- rubocop-ast (>= 1.38.0, < 2.0)
199
+ rubocop-ast (>= 1.48.0, < 2.0)
200
200
  ruby-progressbar (~> 1.7)
201
201
  unicode-display_width (>= 2.4.0, < 4.0)
202
- rubocop-ast (1.46.0)
202
+ rubocop-ast (1.48.0)
203
203
  parser (>= 3.3.7.2)
204
204
  prism (~> 1.4)
205
205
  rubocop-performance (1.24.0)
@@ -226,7 +226,7 @@ GEM
226
226
  sqlite3 (1.7.3-arm64-darwin)
227
227
  sqlite3 (1.7.3-x86_64-linux)
228
228
  stringio (3.1.7)
229
- thor (1.4.0)
229
+ thor (1.5.0)
230
230
  timeout (0.4.3)
231
231
  tomlrb (2.0.3)
232
232
  tzinfo (2.0.6)
@@ -250,17 +250,19 @@ PLATFORMS
250
250
  DEPENDENCIES
251
251
  activerecord (>= 5)
252
252
  appraisal (~> 2.5.0)
253
- base64
254
- bigdecimal
253
+ base64 (~> 0.3.0)
254
+ bigdecimal (~> 3.2.0, < 3.2.3)
255
255
  bundler (~> 2.1)
256
256
  combustion (~> 1.3)
257
+ connection_pool (~> 2.4.1)
257
258
  consent!
258
- erb (< 5.0)
259
+ erb (~> 4.0.4)
259
260
  license_finder (>= 7.0)
260
- logger
261
- mutex_m
261
+ logger (~> 1.7.0)
262
+ minitest (~> 5.25.5)
263
+ mutex_m (~> 0.3.0)
262
264
  net-imap (< 0.5.0)
263
- nokogiri (< 1.18)
265
+ nokogiri (~> 1.17.0, < 1.18)
264
266
  pry (>= 0.14.2)
265
267
  pry-byebug (= 3.10.1)
266
268
  rake (~> 13)
@@ -4,7 +4,11 @@ module Consent
4
4
  class History < ::Consent::ApplicationRecord
5
5
  include Consent::SubjectCoder::Model
6
6
 
7
- enum command: { grant: "grant", revoke: "revoke" }
7
+ if Rails::VERSION::MAJOR >= 7
8
+ enum :command, { grant: "grant", revoke: "revoke" }
9
+ else
10
+ enum command: { grant: "grant", revoke: "revoke" }
11
+ end
8
12
 
9
13
  validates :subject, presence: true
10
14
  validates :action, presence: true
data/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ### [2.4.0] - 2026-02-04
4
+ - Adds ability to verify and synchronize permission definitions across environments using deterministic checksums [#387](https://github.com/powerhome/power-tools/pull/387)
5
+
6
+ ## [2.3.0] - 2025-10-29
7
+
8
+ - Standardize all libs to support ruby 3.0, ruby 3.3 x rails 6.1 through rails 7.2 [#359](https://github.com/powerhome/power-tools/pull/359)
9
+ - Support rails 8 enums [#373](https://github.com/powerhome/power-tools/pull/373)
10
+
3
11
  ## [2.2.0] - 2025-08-08
4
12
 
5
13
  - Add support to Ruby 3.3 and Rails 6.1 [#356](https://github.com/powerhome/power-tools/pull/356)
@@ -28,9 +36,15 @@
28
36
  - Consent released with DSL to design permissions and convenient CanCan::Ability implementation.
29
37
 
30
38
  ## [0.6.0] - 2020-12-22
39
+
31
40
  ## [0.5.2] - 2019-11-28
41
+
32
42
  ## [0.5.0] - 2019-11-25
43
+
33
44
  ## [0.4.3] - 2019-04-02
45
+
34
46
  ## [0.4.2] - 2019-03-28
47
+
35
48
  ## [0.4] - 2019-03-27
49
+
36
50
  ## [0.3.1] - 2016-11-08
data/docs/README.md CHANGED
@@ -133,6 +133,25 @@ department_id = 13, it will run a query similar to:
133
133
  "SELECT * FROM projects WHERE department_id = 1"
134
134
  ```
135
135
 
136
+ ### Verifying Permission Definitions
137
+
138
+ Consent provides methods to verify and synchronize permission definitions across environments:
139
+
140
+ ```ruby
141
+ # Get the concatenated contents of all permission files
142
+ content = Consent.subjects_content([Rails.root.join('app/permissions')])
143
+
144
+ # Calculate a deterministic checksum
145
+ checksum = Consent.subjects_checksum([Rails.root.join('app/permissions')])
146
+ ```
147
+
148
+ These methods are useful for:
149
+ - Verifying permission files are identical across environments
150
+ - Detecting when permission definitions have changed
151
+ - Synchronizing permissions between systems
152
+
153
+ The checksum is deterministic - the same permission file contents will always produce the same SHA256 hash.
154
+
136
155
  ### Subject
137
156
 
138
157
  The subject is the central point of a group of actions and views. It will typically
@@ -1,17 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source "https://rubygems.org"
4
6
 
5
- gem "base64"
6
- gem "bigdecimal"
7
- gem "erb", "< 5.0"
8
- gem "logger"
9
- gem "mutex_m"
7
+ gem "base64", "~> 0.3.0"
8
+ gem "bigdecimal", "~> 3.2.0", "< 3.2.3"
9
+ gem "connection_pool", "~> 2.4.1"
10
+ gem "erb", "~> 4.0.4"
11
+ gem "logger", "~> 1.7.0"
12
+ gem "minitest", "~> 5.25.5"
13
+ gem "mutex_m", "~> 0.3.0"
10
14
  gem "net-imap", "< 0.5.0"
11
- gem "nokogiri", "< 1.18"
15
+ gem "nokogiri", "~> 1.17.0", "< 1.18"
16
+ gem "rails", "6.1.7.7"
12
17
  gem "rubocop-powerhome", path: "../../rubocop-powerhome"
13
18
  gem "securerandom", "< 0.4"
14
19
  gem "zeitwerk", "< 2.7.0"
15
- gem "rails", "6.1.7.7"
16
20
 
17
21
  gemspec path: "../"
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ../../rubocop-powerhome
3
3
  specs:
4
- rubocop-powerhome (0.5.5)
5
- rubocop (= 1.74.0)
4
+ rubocop-powerhome (0.6.0)
5
+ rubocop (= 1.82.1)
6
6
  rubocop-performance
7
7
  rubocop-rails
8
8
  rubocop-rake
@@ -11,7 +11,7 @@ PATH
11
11
  PATH
12
12
  remote: ..
13
13
  specs:
14
- consent (2.2.0)
14
+ consent (2.4.0)
15
15
  cancancan (= 3.2.1)
16
16
 
17
17
  GEM
@@ -86,25 +86,26 @@ GEM
86
86
  builder (3.3.0)
87
87
  byebug (11.1.3)
88
88
  cancancan (3.2.1)
89
- cgi (0.5.0)
89
+ cgi (0.5.1)
90
90
  coderay (1.1.3)
91
91
  combustion (1.5.0)
92
92
  activesupport (>= 3.0.0)
93
93
  railties (>= 3.0.0)
94
94
  thor (>= 0.14.6)
95
- concurrent-ruby (1.3.5)
95
+ concurrent-ruby (1.3.6)
96
+ connection_pool (2.4.1)
96
97
  crass (1.0.6)
97
98
  csv (3.3.5)
98
- date (3.4.1)
99
+ date (3.5.1)
99
100
  diff-lcs (1.6.2)
100
101
  erb (4.0.4)
101
102
  cgi (>= 0.3.3)
102
103
  erubi (1.13.1)
103
- globalid (1.2.1)
104
+ globalid (1.3.0)
104
105
  activesupport (>= 6.1)
105
- i18n (1.14.7)
106
+ i18n (1.14.8)
106
107
  concurrent-ruby (~> 1.0)
107
- json (2.13.2)
108
+ json (2.18.1)
108
109
  language_server-protocol (3.17.0.5)
109
110
  license_finder (7.2.1)
110
111
  bundler
@@ -116,20 +117,21 @@ GEM
116
117
  xml-simple (~> 1.1.9)
117
118
  lint_roller (1.1.0)
118
119
  logger (1.7.0)
119
- loofah (2.24.1)
120
+ loofah (2.25.0)
120
121
  crass (~> 1.0.2)
121
122
  nokogiri (>= 1.12.0)
122
- mail (2.8.1)
123
+ mail (2.9.0)
124
+ logger
123
125
  mini_mime (>= 0.1.1)
124
126
  net-imap
125
127
  net-pop
126
128
  net-smtp
127
- marcel (1.0.4)
129
+ marcel (1.1.0)
128
130
  method_source (1.1.0)
129
131
  mini_mime (1.1.5)
130
132
  minitest (5.25.5)
131
133
  mutex_m (0.3.0)
132
- net-imap (0.4.22)
134
+ net-imap (0.4.23)
133
135
  date
134
136
  net-protocol
135
137
  net-pop (0.1.2)
@@ -138,16 +140,16 @@ GEM
138
140
  timeout
139
141
  net-smtp (0.5.1)
140
142
  net-protocol
141
- nio4r (2.7.4)
143
+ nio4r (2.7.5)
142
144
  nokogiri (1.17.2-arm64-darwin)
143
145
  racc (~> 1.4)
144
146
  nokogiri (1.17.2-x86_64-linux)
145
147
  racc (~> 1.4)
146
148
  parallel (1.27.0)
147
- parser (3.3.9.0)
149
+ parser (3.3.10.1)
148
150
  ast (~> 2.4.1)
149
151
  racc
150
- prism (1.4.0)
152
+ prism (1.9.0)
151
153
  pry (0.14.2)
152
154
  coderay (~> 1.1)
153
155
  method_source (~> 1.0)
@@ -155,7 +157,7 @@ GEM
155
157
  byebug (~> 11.0)
156
158
  pry (>= 0.13, < 0.15)
157
159
  racc (1.8.1)
158
- rack (2.2.17)
160
+ rack (2.2.21)
159
161
  rack-test (2.2.0)
160
162
  rack (>= 1.3)
161
163
  rails (6.1.7.7)
@@ -187,19 +189,19 @@ GEM
187
189
  rake (>= 12.2)
188
190
  thor (~> 1.0)
189
191
  rainbow (3.1.1)
190
- rake (13.3.0)
191
- regexp_parser (2.11.0)
192
- rexml (3.4.1)
193
- rspec (3.13.1)
192
+ rake (13.3.1)
193
+ regexp_parser (2.11.3)
194
+ rexml (3.4.4)
195
+ rspec (3.13.2)
194
196
  rspec-core (~> 3.13.0)
195
197
  rspec-expectations (~> 3.13.0)
196
198
  rspec-mocks (~> 3.13.0)
197
- rspec-core (3.13.5)
199
+ rspec-core (3.13.6)
198
200
  rspec-support (~> 3.13.0)
199
201
  rspec-expectations (3.13.5)
200
202
  diff-lcs (>= 1.2.0, < 2.0)
201
203
  rspec-support (~> 3.13.0)
202
- rspec-mocks (3.13.5)
204
+ rspec-mocks (3.13.7)
203
205
  diff-lcs (>= 1.2.0, < 2.0)
204
206
  rspec-support (~> 3.13.0)
205
207
  rspec-rails (6.1.5)
@@ -210,8 +212,8 @@ GEM
210
212
  rspec-expectations (~> 3.13)
211
213
  rspec-mocks (~> 3.13)
212
214
  rspec-support (~> 3.13)
213
- rspec-support (3.13.4)
214
- rubocop (1.74.0)
215
+ rspec-support (3.13.7)
216
+ rubocop (1.82.1)
215
217
  json (~> 2.3)
216
218
  language_server-protocol (~> 3.17.0.2)
217
219
  lint_roller (~> 1.1.0)
@@ -219,28 +221,28 @@ GEM
219
221
  parser (>= 3.3.0.2)
220
222
  rainbow (>= 2.2.2, < 4.0)
221
223
  regexp_parser (>= 2.9.3, < 3.0)
222
- rubocop-ast (>= 1.38.0, < 2.0)
224
+ rubocop-ast (>= 1.48.0, < 2.0)
223
225
  ruby-progressbar (~> 1.7)
224
226
  unicode-display_width (>= 2.4.0, < 4.0)
225
- rubocop-ast (1.46.0)
227
+ rubocop-ast (1.49.0)
226
228
  parser (>= 3.3.7.2)
227
- prism (~> 1.4)
228
- rubocop-performance (1.24.0)
229
+ prism (~> 1.7)
230
+ rubocop-performance (1.26.1)
229
231
  lint_roller (~> 1.1)
230
- rubocop (>= 1.72.1, < 2.0)
231
- rubocop-ast (>= 1.38.0, < 2.0)
232
- rubocop-rails (2.30.3)
232
+ rubocop (>= 1.75.0, < 2.0)
233
+ rubocop-ast (>= 1.47.1, < 2.0)
234
+ rubocop-rails (2.34.3)
233
235
  activesupport (>= 4.2.0)
234
236
  lint_roller (~> 1.1)
235
237
  rack (>= 1.1)
236
- rubocop (>= 1.72.1, < 2.0)
237
- rubocop-ast (>= 1.38.0, < 2.0)
238
+ rubocop (>= 1.75.0, < 2.0)
239
+ rubocop-ast (>= 1.44.0, < 2.0)
238
240
  rubocop-rake (0.7.1)
239
241
  lint_roller (~> 1.1)
240
242
  rubocop (>= 1.72.1)
241
- rubocop-rspec (3.6.0)
243
+ rubocop-rspec (3.9.0)
242
244
  lint_roller (~> 1.1)
243
- rubocop (~> 1.72, >= 1.72.1)
245
+ rubocop (~> 1.81)
244
246
  ruby-progressbar (1.13.0)
245
247
  rubyzip (2.4.1)
246
248
  securerandom (0.3.2)
@@ -254,14 +256,14 @@ GEM
254
256
  sprockets (>= 3.0.0)
255
257
  sqlite3 (1.7.3-arm64-darwin)
256
258
  sqlite3 (1.7.3-x86_64-linux)
257
- thor (1.4.0)
258
- timeout (0.4.3)
259
- tomlrb (2.0.3)
259
+ thor (1.5.0)
260
+ timeout (0.6.0)
261
+ tomlrb (2.0.4)
260
262
  tzinfo (2.0.6)
261
263
  concurrent-ruby (~> 1.0)
262
- unicode-display_width (3.1.4)
263
- unicode-emoji (~> 4.0, >= 4.0.4)
264
- unicode-emoji (4.0.4)
264
+ unicode-display_width (3.2.0)
265
+ unicode-emoji (~> 4.1)
266
+ unicode-emoji (4.2.0)
265
267
  websocket-driver (0.8.0)
266
268
  base64
267
269
  websocket-extensions (>= 0.1.0)
@@ -278,17 +280,19 @@ PLATFORMS
278
280
  DEPENDENCIES
279
281
  activerecord (>= 5)
280
282
  appraisal (~> 2.5.0)
281
- base64
282
- bigdecimal
283
+ base64 (~> 0.3.0)
284
+ bigdecimal (~> 3.2.0, < 3.2.3)
283
285
  bundler (~> 2.1)
284
286
  combustion (~> 1.3)
287
+ connection_pool (~> 2.4.1)
285
288
  consent!
286
- erb (< 5.0)
289
+ erb (~> 4.0.4)
287
290
  license_finder (>= 7.0)
288
- logger
289
- mutex_m
291
+ logger (~> 1.7.0)
292
+ minitest (~> 5.25.5)
293
+ mutex_m (~> 0.3.0)
290
294
  net-imap (< 0.5.0)
291
- nokogiri (< 1.18)
295
+ nokogiri (~> 1.17.0, < 1.18)
292
296
  pry (>= 0.14.2)
293
297
  pry-byebug (= 3.10.1)
294
298
  rails (= 6.1.7.7)
@@ -1,17 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
5
  source "https://rubygems.org"
4
6
 
5
- gem "base64"
6
- gem "bigdecimal"
7
- gem "erb", "< 5.0"
8
- gem "logger"
9
- gem "mutex_m"
7
+ gem "base64", "~> 0.3.0"
8
+ gem "bigdecimal", "~> 3.2.0", "< 3.2.3"
9
+ gem "connection_pool", "~> 2.4.1"
10
+ gem "erb", "~> 4.0.4"
11
+ gem "logger", "~> 1.7.0"
12
+ gem "minitest", "~> 5.25.5"
13
+ gem "mutex_m", "~> 0.3.0"
10
14
  gem "net-imap", "< 0.5.0"
11
- gem "nokogiri", "< 1.18"
15
+ gem "nokogiri", "~> 1.17.0", "< 1.18"
16
+ gem "rails", "7.0.8.7"
12
17
  gem "rubocop-powerhome", path: "../../rubocop-powerhome"
13
18
  gem "securerandom", "< 0.4"
14
19
  gem "zeitwerk", "< 2.7.0"
15
- gem "rails", "7.0.8.7"
16
20
 
17
21
  gemspec path: "../"