resource_policy 1.1.0 → 1.2.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: 2f65fc6083e96120d13e9f16f9209da6821690d5868fbb8c5e220af87c2cca00
4
- data.tar.gz: 69f4d3e2969688640b28d0621625735caf47c4601aee45aa9f4b499bf2f7c708
3
+ metadata.gz: 63bbda72581f4db59a3a27f33616db5480c90a39baff857f4886a89338c5b3c9
4
+ data.tar.gz: 139231ccbac6d84cb8d697be8c34f46fded3ff66e46ce65b7fc4ee5397631f1a
5
5
  SHA512:
6
- metadata.gz: d6a57863a8e23dc296549b227e612ae64837431d3f7f2512f795e0277e262d9eb3482f77a26844a4c028e97f4f21f3605616a52795e8088b62d32899baacfc4a
7
- data.tar.gz: 42568d8e854a936150c590ca4691a7b40f69881de02fe909b53fa0f1ec5f5763731c51e0bf0f3eea91c83a4ef721be023eb9f4b5782e4bd2fd9d8b23a7cd6085
6
+ metadata.gz: e81553c1ec0c7dd0e00ec063ceef818a34f70a24084f515cc9d32302d8b8f628398def7ebe04c42bfc1c33174b970a4c6ab76d31f7f1e2ef1048fe4ae3dae151
7
+ data.tar.gz: 394f96baaba9120f15fc6b25465a230e4b89961faef05bcfc9f885d7ee6ba763501e9576cce16f0ac5557225a42fbaa678478ceff2c8b5ce159a7616d38741d7
@@ -4,15 +4,18 @@ jobs:
4
4
  specs:
5
5
  strategy:
6
6
  matrix:
7
- ruby-version: ['2.7', '3.0', '3.1']
7
+ ruby-version: ['3.2', '3.3', '3.4', '4.0']
8
8
 
9
9
  runs-on: ubuntu-latest
10
- env:
11
- CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
12
10
  steps:
13
- - uses: actions/checkout@v2
11
+ - uses: actions/checkout@v4
14
12
  - uses: ruby/setup-ruby@v1
15
13
  with:
16
14
  ruby-version: ${{ matrix.ruby-version }}
17
15
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
18
16
  - run: bundle exec rake
17
+ - name: Upload coverage to Codecov
18
+ uses: codecov/codecov-action@v5
19
+ with:
20
+ token: ${{ secrets.CODECOV_TOKEN }}
21
+ files: ./coverage/lcov.info
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.2
1
+ 4.0.6
data/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ * Removed: support for Ruby < 3.2 (CI now tests Ruby 3.2–4.0)
11
+ * Added: short-hand method for getting allowed actions
12
+ * Added: support for proc type validator options
13
+ * Added: `PolicyConfiguration#configured_attribute` for looking up one configured attribute
14
+ * Changed: protected resource and attributes policy reads look the attribute up directly instead of rebuilding the attributes hash on every read. These lookups now use `PolicyConfiguration#configured_attribute` and no longer go through `PolicyConfiguration#attributes`; if you override `#attributes` in a custom configuration, override `#configured_attribute` as well
10
15
  * Added/Changed/Deprecated/Removed/Fixed/Security: YOUR CHANGE HERE
11
16
 
12
17
  ## [1.1.0]
data/Gemfile CHANGED
@@ -3,8 +3,8 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  group :test do
6
- gem 'codecov', require: false
7
6
  gem 'simplecov', require: false
7
+ gem 'simplecov-lcov', require: false
8
8
  end
9
9
 
10
10
  # Specify your gem's dependencies in resource_policy.gemspec
data/Gemfile.lock CHANGED
@@ -1,224 +1,279 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- resource_policy (1.1.0)
4
+ resource_policy (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actioncable (7.0.4.2)
10
- actionpack (= 7.0.4.2)
11
- activesupport (= 7.0.4.2)
9
+ actioncable (8.0.5.1)
10
+ actionpack (= 8.0.5.1)
11
+ activesupport (= 8.0.5.1)
12
12
  nio4r (~> 2.0)
13
13
  websocket-driver (>= 0.6.1)
14
- actionmailbox (7.0.4.2)
15
- actionpack (= 7.0.4.2)
16
- activejob (= 7.0.4.2)
17
- activerecord (= 7.0.4.2)
18
- activestorage (= 7.0.4.2)
19
- activesupport (= 7.0.4.2)
20
- mail (>= 2.7.1)
21
- net-imap
22
- net-pop
23
- net-smtp
24
- actionmailer (7.0.4.2)
25
- actionpack (= 7.0.4.2)
26
- actionview (= 7.0.4.2)
27
- activejob (= 7.0.4.2)
28
- activesupport (= 7.0.4.2)
29
- mail (~> 2.5, >= 2.5.4)
30
- net-imap
31
- net-pop
32
- net-smtp
33
- rails-dom-testing (~> 2.0)
34
- actionpack (7.0.4.2)
35
- actionview (= 7.0.4.2)
36
- activesupport (= 7.0.4.2)
37
- rack (~> 2.0, >= 2.2.0)
14
+ zeitwerk (~> 2.6)
15
+ actionmailbox (8.0.5.1)
16
+ actionpack (= 8.0.5.1)
17
+ activejob (= 8.0.5.1)
18
+ activerecord (= 8.0.5.1)
19
+ activestorage (= 8.0.5.1)
20
+ activesupport (= 8.0.5.1)
21
+ mail (>= 2.8.0)
22
+ actionmailer (8.0.5.1)
23
+ actionpack (= 8.0.5.1)
24
+ actionview (= 8.0.5.1)
25
+ activejob (= 8.0.5.1)
26
+ activesupport (= 8.0.5.1)
27
+ mail (>= 2.8.0)
28
+ rails-dom-testing (~> 2.2)
29
+ actionpack (8.0.5.1)
30
+ actionview (= 8.0.5.1)
31
+ activesupport (= 8.0.5.1)
32
+ nokogiri (>= 1.8.5)
33
+ rack (>= 2.2.4)
34
+ rack-session (>= 1.0.1)
38
35
  rack-test (>= 0.6.3)
39
- rails-dom-testing (~> 2.0)
40
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
41
- actiontext (7.0.4.2)
42
- actionpack (= 7.0.4.2)
43
- activerecord (= 7.0.4.2)
44
- activestorage (= 7.0.4.2)
45
- activesupport (= 7.0.4.2)
36
+ rails-dom-testing (~> 2.2)
37
+ rails-html-sanitizer (~> 1.6)
38
+ useragent (~> 0.16)
39
+ actiontext (8.0.5.1)
40
+ actionpack (= 8.0.5.1)
41
+ activerecord (= 8.0.5.1)
42
+ activestorage (= 8.0.5.1)
43
+ activesupport (= 8.0.5.1)
46
44
  globalid (>= 0.6.0)
47
45
  nokogiri (>= 1.8.5)
48
- actionview (7.0.4.2)
49
- activesupport (= 7.0.4.2)
46
+ actionview (8.0.5.1)
47
+ activesupport (= 8.0.5.1)
50
48
  builder (~> 3.1)
51
- erubi (~> 1.4)
52
- rails-dom-testing (~> 2.0)
53
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
54
- activejob (7.0.4.2)
55
- activesupport (= 7.0.4.2)
49
+ erubi (~> 1.11)
50
+ rails-dom-testing (~> 2.2)
51
+ rails-html-sanitizer (~> 1.6)
52
+ activejob (8.0.5.1)
53
+ activesupport (= 8.0.5.1)
56
54
  globalid (>= 0.3.6)
57
- activemodel (7.0.4.2)
58
- activesupport (= 7.0.4.2)
59
- activerecord (7.0.4.2)
60
- activemodel (= 7.0.4.2)
61
- activesupport (= 7.0.4.2)
62
- activestorage (7.0.4.2)
63
- actionpack (= 7.0.4.2)
64
- activejob (= 7.0.4.2)
65
- activerecord (= 7.0.4.2)
66
- activesupport (= 7.0.4.2)
55
+ activemodel (8.0.5.1)
56
+ activesupport (= 8.0.5.1)
57
+ activerecord (8.0.5.1)
58
+ activemodel (= 8.0.5.1)
59
+ activesupport (= 8.0.5.1)
60
+ timeout (>= 0.4.0)
61
+ activestorage (8.0.5.1)
62
+ actionpack (= 8.0.5.1)
63
+ activejob (= 8.0.5.1)
64
+ activerecord (= 8.0.5.1)
65
+ activesupport (= 8.0.5.1)
67
66
  marcel (~> 1.0)
68
- mini_mime (>= 1.1.0)
69
- activesupport (7.0.4.2)
70
- concurrent-ruby (~> 1.0, >= 1.0.2)
67
+ activesupport (8.0.5.1)
68
+ base64
69
+ benchmark (>= 0.3)
70
+ bigdecimal
71
+ concurrent-ruby (~> 1.0, >= 1.3.1)
72
+ connection_pool (>= 2.2.5)
73
+ drb
71
74
  i18n (>= 1.6, < 2)
75
+ logger (>= 1.4.2)
72
76
  minitest (>= 5.1)
73
- tzinfo (~> 2.0)
74
- ast (2.4.2)
75
- builder (3.2.4)
76
- byebug (11.1.3)
77
- codecov (0.6.0)
78
- simplecov (>= 0.15, < 0.22)
77
+ securerandom (>= 0.3)
78
+ tzinfo (~> 2.0, >= 2.0.5)
79
+ uri (>= 0.13.1)
80
+ ast (2.4.3)
81
+ base64 (0.3.0)
82
+ benchmark (0.5.0)
83
+ bigdecimal (4.1.3)
84
+ builder (3.3.0)
85
+ byebug (13.0.0)
86
+ reline (>= 0.6.0)
79
87
  coderay (1.1.3)
80
- concurrent-ruby (1.2.0)
81
- crass (1.0.6)
82
- date (3.3.3)
83
- diff-lcs (1.5.0)
84
- docile (1.4.0)
85
- erubi (1.12.0)
86
- globalid (1.1.0)
87
- activesupport (>= 5.0)
88
- i18n (1.12.0)
88
+ concurrent-ruby (1.3.8)
89
+ connection_pool (3.0.2)
90
+ crass (1.0.7)
91
+ date (3.5.1)
92
+ diff-lcs (1.6.2)
93
+ drb (2.2.3)
94
+ erb (6.0.7)
95
+ erubi (1.13.1)
96
+ globalid (1.4.0)
97
+ activesupport (>= 6.1)
98
+ i18n (1.15.2)
89
99
  concurrent-ruby (~> 1.0)
90
- json (2.6.3)
91
- loofah (2.19.1)
100
+ io-console (0.9.4)
101
+ irb (1.18.0)
102
+ pp (>= 0.6.0)
103
+ prism (>= 1.3.0)
104
+ rdoc (>= 4.0.0)
105
+ reline (>= 0.4.2)
106
+ json (3.0.2)
107
+ language_server-protocol (3.17.0.6)
108
+ lint_roller (1.1.0)
109
+ logger (1.7.0)
110
+ loofah (2.25.2)
92
111
  crass (~> 1.0.2)
93
- nokogiri (>= 1.5.9)
94
- mail (2.8.0.1)
112
+ nokogiri (>= 1.12.0)
113
+ mail (2.9.1)
114
+ logger
95
115
  mini_mime (>= 0.1.1)
96
116
  net-imap
97
117
  net-pop
98
118
  net-smtp
99
- marcel (1.0.2)
100
- method_source (1.0.0)
101
- mini_mime (1.1.2)
102
- mini_portile2 (2.8.1)
103
- minitest (5.17.0)
104
- net-imap (0.3.4)
119
+ marcel (1.2.1)
120
+ method_source (1.1.0)
121
+ mini_mime (1.1.5)
122
+ minitest (6.0.6)
123
+ drb (~> 2.0)
124
+ prism (~> 1.5)
125
+ net-imap (0.6.7)
105
126
  date
106
127
  net-protocol
107
128
  net-pop (0.1.2)
108
129
  net-protocol
109
- net-protocol (0.2.1)
130
+ net-protocol (0.4.0)
110
131
  timeout
111
- net-smtp (0.3.3)
132
+ net-smtp (0.5.1)
112
133
  net-protocol
113
- nio4r (2.5.8)
114
- nokogiri (1.14.1)
115
- mini_portile2 (~> 2.8.0)
134
+ nio4r (2.7.5)
135
+ nokogiri (1.19.4-arm64-darwin)
116
136
  racc (~> 1.4)
117
- parallel (1.22.1)
118
- parser (3.2.0.0)
137
+ nokogiri (1.19.4-x86_64-linux-gnu)
138
+ racc (~> 1.4)
139
+ parallel (1.28.0)
140
+ parser (3.3.12.0)
119
141
  ast (~> 2.4.1)
120
- pry (0.14.2)
142
+ racc
143
+ pp (0.6.4)
144
+ prettyprint
145
+ prettyprint (0.2.0)
146
+ prism (1.9.0)
147
+ pry (0.16.0)
121
148
  coderay (~> 1.1)
122
149
  method_source (~> 1.0)
123
- pry-byebug (3.10.1)
124
- byebug (~> 11.0)
125
- pry (>= 0.13, < 0.15)
126
- racc (1.6.2)
127
- rack (2.2.6.2)
128
- rack-test (2.0.2)
150
+ reline (>= 0.6.0)
151
+ pry-byebug (3.12.0)
152
+ byebug (~> 13.0)
153
+ pry (>= 0.13, < 0.17)
154
+ racc (1.8.1)
155
+ rack (3.2.7)
156
+ rack-session (2.1.2)
157
+ base64 (>= 0.1.0)
158
+ rack (>= 3.0.0)
159
+ rack-test (2.2.0)
129
160
  rack (>= 1.3)
130
- rails (7.0.4.2)
131
- actioncable (= 7.0.4.2)
132
- actionmailbox (= 7.0.4.2)
133
- actionmailer (= 7.0.4.2)
134
- actionpack (= 7.0.4.2)
135
- actiontext (= 7.0.4.2)
136
- actionview (= 7.0.4.2)
137
- activejob (= 7.0.4.2)
138
- activemodel (= 7.0.4.2)
139
- activerecord (= 7.0.4.2)
140
- activestorage (= 7.0.4.2)
141
- activesupport (= 7.0.4.2)
161
+ rackup (2.3.1)
162
+ rack (>= 3)
163
+ rails (8.0.5.1)
164
+ actioncable (= 8.0.5.1)
165
+ actionmailbox (= 8.0.5.1)
166
+ actionmailer (= 8.0.5.1)
167
+ actionpack (= 8.0.5.1)
168
+ actiontext (= 8.0.5.1)
169
+ actionview (= 8.0.5.1)
170
+ activejob (= 8.0.5.1)
171
+ activemodel (= 8.0.5.1)
172
+ activerecord (= 8.0.5.1)
173
+ activestorage (= 8.0.5.1)
174
+ activesupport (= 8.0.5.1)
142
175
  bundler (>= 1.15.0)
143
- railties (= 7.0.4.2)
144
- rails-dom-testing (2.0.3)
145
- activesupport (>= 4.2.0)
176
+ railties (= 8.0.5.1)
177
+ rails-dom-testing (2.3.0)
178
+ activesupport (>= 5.0.0)
179
+ minitest
146
180
  nokogiri (>= 1.6)
147
- rails-html-sanitizer (1.5.0)
148
- loofah (~> 2.19, >= 2.19.1)
149
- railties (7.0.4.2)
150
- actionpack (= 7.0.4.2)
151
- activesupport (= 7.0.4.2)
152
- method_source
181
+ rails-html-sanitizer (1.7.1)
182
+ loofah (~> 2.25, >= 2.25.2)
183
+ 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)
184
+ railties (8.0.5.1)
185
+ actionpack (= 8.0.5.1)
186
+ activesupport (= 8.0.5.1)
187
+ irb (~> 1.13)
188
+ rackup (>= 1.0.0)
153
189
  rake (>= 12.2)
154
- thor (~> 1.0)
155
- zeitwerk (~> 2.5)
190
+ thor (~> 1.0, >= 1.2.2)
191
+ tsort (>= 0.2)
192
+ zeitwerk (~> 2.6)
156
193
  rainbow (3.1.1)
157
- rake (13.0.6)
158
- regexp_parser (2.6.2)
159
- rexml (3.2.5)
160
- rspec (3.12.0)
161
- rspec-core (~> 3.12.0)
162
- rspec-expectations (~> 3.12.0)
163
- rspec-mocks (~> 3.12.0)
164
- rspec-core (3.12.0)
165
- rspec-support (~> 3.12.0)
166
- rspec-expectations (3.12.2)
194
+ rake (13.4.2)
195
+ rbs (4.1.3)
196
+ logger
197
+ prism (>= 1.6.0)
198
+ tsort
199
+ rdoc (8.0.0)
200
+ erb
201
+ prism (>= 1.6.0)
202
+ rbs (>= 4.0.0)
203
+ tsort
204
+ regexp_parser (2.13.0)
205
+ reline (0.7.0)
206
+ io-console (~> 0.5)
207
+ rspec (3.13.2)
208
+ rspec-core (~> 3.13.0)
209
+ rspec-expectations (~> 3.13.0)
210
+ rspec-mocks (~> 3.13.0)
211
+ rspec-core (3.13.6)
212
+ rspec-support (~> 3.13.0)
213
+ rspec-expectations (3.13.5)
167
214
  diff-lcs (>= 1.2.0, < 2.0)
168
- rspec-support (~> 3.12.0)
169
- rspec-mocks (3.12.3)
215
+ rspec-support (~> 3.13.0)
216
+ rspec-mocks (3.13.8)
170
217
  diff-lcs (>= 1.2.0, < 2.0)
171
- rspec-support (~> 3.12.0)
172
- rspec-support (3.12.0)
173
- rubocop (1.44.1)
174
- json (~> 2.3)
175
- parallel (~> 1.10)
176
- parser (>= 3.2.0.0)
218
+ rspec-support (~> 3.13.0)
219
+ rspec-support (3.13.7)
220
+ rubocop (1.91.0)
221
+ json (>= 2.3)
222
+ language_server-protocol (~> 3.17.0.2)
223
+ lint_roller (~> 1.1.0)
224
+ parallel (>= 1.10)
225
+ parser (>= 3.3.0.2)
177
226
  rainbow (>= 2.2.2, < 4.0)
178
- regexp_parser (>= 1.8, < 3.0)
179
- rexml (>= 3.2.5, < 4.0)
180
- rubocop-ast (>= 1.24.1, < 2.0)
227
+ regexp_parser (>= 2.9.3, < 3.0)
228
+ rubocop-ast (>= 1.49.0, < 2.0)
181
229
  ruby-progressbar (~> 1.7)
182
- unicode-display_width (>= 2.4.0, < 3.0)
183
- rubocop-ast (1.24.1)
184
- parser (>= 3.1.1.0)
185
- rubocop-capybara (2.17.0)
186
- rubocop (~> 1.41)
187
- rubocop-performance (1.15.2)
188
- rubocop (>= 1.7.0, < 2.0)
189
- rubocop-ast (>= 0.4.0)
190
- rubocop-rails (2.17.4)
230
+ unicode-display_width (>= 2.4.0, < 4.0)
231
+ rubocop-ast (1.50.0)
232
+ parser (>= 3.3.7.2)
233
+ prism (~> 1.7)
234
+ rubocop-performance (1.27.0)
235
+ lint_roller (~> 1.1)
236
+ rubocop (>= 1.89.0, < 2.0)
237
+ rubocop-ast (>= 1.47.1, < 2.0)
238
+ rubocop-rails (2.38.0)
191
239
  activesupport (>= 4.2.0)
240
+ lint_roller (~> 1.1)
192
241
  rack (>= 1.1)
193
- rubocop (>= 1.33.0, < 2.0)
194
- rubocop-rspec (2.18.1)
195
- rubocop (~> 1.33)
196
- rubocop-capybara (~> 2.17)
197
- ruby-progressbar (1.11.0)
198
- simplecov (0.21.2)
199
- docile (~> 1.1)
200
- simplecov-html (~> 0.11)
201
- simplecov_json_formatter (~> 0.1)
202
- simplecov-html (0.12.3)
203
- simplecov_json_formatter (0.1.4)
204
- thor (1.2.1)
205
- timeout (0.3.1)
242
+ rubocop (>= 1.89.0, < 2.0)
243
+ rubocop-ast (>= 1.44.0, < 2.0)
244
+ rubocop-rspec (3.10.2)
245
+ lint_roller (~> 1.1)
246
+ regexp_parser (>= 2.0)
247
+ rubocop (~> 1.86, >= 1.86.2)
248
+ ruby-progressbar (1.13.0)
249
+ securerandom (0.4.1)
250
+ simplecov (1.2.0)
251
+ simplecov-lcov (0.9.0)
252
+ thor (1.5.0)
253
+ timeout (0.6.1)
254
+ tsort (0.2.0)
206
255
  tzinfo (2.0.6)
207
256
  concurrent-ruby (~> 1.0)
208
- unicode-display_width (2.4.2)
209
- websocket-driver (0.7.5)
257
+ unicode-display_width (3.3.0)
258
+ unicode-emoji (~> 4.3)
259
+ unicode-emoji (4.3.0)
260
+ uri (1.1.1)
261
+ useragent (0.16.11)
262
+ websocket-driver (0.8.2)
263
+ base64
210
264
  websocket-extensions (>= 0.1.0)
211
265
  websocket-extensions (0.1.5)
212
- zeitwerk (2.6.6)
266
+ zeitwerk (2.8.3)
213
267
 
214
268
  PLATFORMS
215
- ruby
269
+ arm64-darwin-23
270
+ arm64-darwin-25
271
+ x86_64-linux
216
272
 
217
273
  DEPENDENCIES
218
- bundler (~> 2.0)
219
- codecov
274
+ bundler (~> 4.0)
220
275
  pry-byebug
221
- rails (~> 7.0.0)
276
+ rails (~> 8.0.0)
222
277
  rake (~> 13.0)
223
278
  resource_policy!
224
279
  rspec (~> 3.0)
@@ -227,6 +282,7 @@ DEPENDENCIES
227
282
  rubocop-rails
228
283
  rubocop-rspec
229
284
  simplecov
285
+ simplecov-lcov
230
286
 
231
287
  BUNDLED WITH
232
- 2.0.1
288
+ 4.0.21
data/docs/README.md CHANGED
@@ -51,11 +51,11 @@ class UserPolicy
51
51
  include ResourcePolicy::Policy
52
52
 
53
53
  policy do |c|
54
- c.action(:read).allowed # current_user can always see user
55
- c.action(:write).allowed(if: :admin?) # only admin current_user can update user
54
+ c.action(:show).allowed # current_user can always see user
55
+ c.action(:update).allowed(if: :admin?) # only admin current_user can update user
56
56
  end
57
57
 
58
- def initialize(user, current_user:)
58
+ def initialize(user, current_user)
59
59
  @user = user
60
60
  @current_user = current_user
61
61
  end
@@ -71,9 +71,9 @@ end
71
71
  #### Using action policy
72
72
 
73
73
  ```ruby
74
- policy = UserPolicy.new(user, current_user: current_user)
75
- policy.action(:read).allowed? # => true
76
- policy.action(:write).allowed? # ... depends on `admin?` result
74
+ policy = UserPolicy.new(user, current_user)
75
+ policy.action(:show).allowed? # => true
76
+ policy.action(:update).allowed? # ... depends on `admin?` result
77
77
  ```
78
78
 
79
79
  ### Attributes policy
@@ -92,7 +92,7 @@ class UserPolicy
92
92
  .allowed(:write, if: :admin?) # only admin current_user can change email
93
93
  end
94
94
 
95
- def initialize(user, current_user:)
95
+ def initialize(user, current_user)
96
96
  @user = user
97
97
  @current_user = current_user
98
98
  end
@@ -108,9 +108,9 @@ end
108
108
  #### Using attributes policy
109
109
 
110
110
  ```ruby
111
- policy = UserPolicy.new(user, current_user: current_user)
111
+ policy = UserPolicy.new(user, current_user)
112
112
  policy.attribute(:email).readable? # => true
113
- policy.action(:email).writable? # ... depends on `admin?` result
113
+ policy.attribute(:email).writable? # ... depends on `admin?` result
114
114
  ```
115
115
 
116
116
  #### Using protector
@@ -123,7 +123,7 @@ class UserPolicy
123
123
 
124
124
  policy do |c|
125
125
  c.attribute(:id).allowed(:read)
126
- c.attribute(:salary).allowed(:read, if: :admin?)
126
+ c.attribute(:email).allowed(:read, if: :admin?)
127
127
  end
128
128
 
129
129
  ...
@@ -139,7 +139,8 @@ user = User.find(1337)
139
139
  user.id #=> 1337
140
140
  user.email #=> "john.doe@example.com"
141
141
 
142
- protected_user = UserPolicy.attributes_policy.protect(user, current_user: current_user)
142
+ policy = UserPolicy.new(user, current_user)
143
+ protected_user = policy.protected_resource
143
144
  protected_user.id #=> 1337
144
145
  protected_user.email # nil
145
146
  ```
data/docs/_sidebar.md CHANGED
@@ -2,6 +2,6 @@
2
2
  * Components
3
3
  * [Policy](components/policy)
4
4
  * [ActionsPolicy](components/actions_policy)
5
- * [ActionsPolicy](components/actions_validator)
5
+ * [ActionValidator](components/action_validator)
6
6
  * [AttributesPolicy](components/attributes_policy)
7
- * [ActionsPolicy](components/attributes_validator)
7
+ * [AttributesValidator](components/attributes_validator)
@@ -6,7 +6,7 @@ The `ResourcePolicy::ActionValidator` is a validator used to check the policy of
6
6
 
7
7
  The `ResourcePolicy::ActionValidator` accepts two options:
8
8
 
9
- - `:allowed_to` (required) - Specifies the action type that needs to be checked. This can be a symbol or a string.
9
+ - `:allowed_to` (required) - Specifies the action type that needs to be checked. This can be a symbol, string or proc.
10
10
  - `:as` (optional) - Specifies the key that will be used to display errors. This is useful if you want to rename the attribute being validated.
11
11
 
12
12
  ## Usage Example
@@ -31,4 +31,30 @@ else
31
31
  end
32
32
  ```
33
33
 
34
- In this example, the `SomeClass` has an attribute named `some_policy` which is being validated using the `ResourcePolicy::ActionValidator`. The validator checks if the create action is allowed using the SomePolicy object. If the action is not allowed, an error message will be added to the `record.errors` object with the key `:some_item`. If the `:as` option is not provided, the key used to display the error will be the name of the attribute being validated.
34
+ ## Usage Example with proc
35
+
36
+ ```ruby
37
+ require 'resource_policy/action_validator'
38
+
39
+ class SomeClass < ActiveRecord::Base
40
+ validates :some_policy, 'resource_policy/action': { allowed_to: -> { custom_allowed_to }, as: :some_item }
41
+
42
+ def some_policy
43
+ SomePolicy.new
44
+ end
45
+
46
+ def custom_allowed_to
47
+ new_record? ? :create : :update
48
+ end
49
+ end
50
+
51
+ new_object = SomeClass.new
52
+ new_object.valid?
53
+ new_object.errors.messages # => { some_item: ['action "create" is not allowed'] }
54
+
55
+ existing_object = SomeClass.find(1)
56
+ existing_object.valid?
57
+ existing_object.errors.messages # => { some_item: ['action "update" is not allowed'] }
58
+ ```
59
+
60
+ In this example, the `SomeClass` has an attribute named `some_policy` which is validated using the `ResourcePolicy::ActionValidator`. The validator calls `custom_allowed_to` method on our model to determine which action to use. If record is new, it will check policy for the `create` action. If the record saved, it will check policy for `update` action. When the action is not allowed, an error message will be added to the `record.errors` object with the key `:some_item`. If the `:as` option is not provided, the key used to display the error will be the name of the attribute being validated.
@@ -11,8 +11,8 @@ class UserPolicy
11
11
  include ResourcePolicy::Policy
12
12
 
13
13
  policy do |c|
14
- c.action(:read).allowed
15
- c.action(:write).allowed(if: %i[admin? admin?])
14
+ c.action(:show).allowed
15
+ c.action(:update).allowed(if: %i[admin? admin?])
16
16
  end
17
17
 
18
18
  def initialize(user, current_user)
@@ -35,8 +35,8 @@ If no condition is given then action will be always allowed.
35
35
 
36
36
  This config means:
37
37
 
38
- * `read` action is always allowed;
39
- * `write` action is allowed only if both `admin?` and `writable?` methods returns `true`.
38
+ * `show` action is always allowed;
39
+ * `update` action is allowed only if both `admin?` and `writable?` methods returns `true`.
40
40
 
41
41
 
42
42
  ### policy#group
@@ -12,7 +12,7 @@ class UserPolicy
12
12
  include ResourcePolicy::AttributesPolicy
13
13
 
14
14
  policy do |c|
15
- c.attribute(:first_name)
15
+ c.attribute(:email)
16
16
  .allowed(:read)
17
17
  .allowed(:write, if: %i[admin? writable?])
18
18
  end
@@ -7,7 +7,7 @@
7
7
  The validates method requires two options:
8
8
 
9
9
  - `:apply_to` (required) - The name of the method that returns the hash that needs to be validated.
10
- - `:allowed_to` (required) - The access level that we need to check. This can be either :read or :write.
10
+ - `:allowed_to` (required) - The access level that we need to check. This can be Symbol, String or Proc.
11
11
 
12
12
  ## Usage example
13
13
 
@@ -35,3 +35,41 @@ end
35
35
 
36
36
  In this example, the `SomeClass` has an attribute named `some_policy` which is being validated using the `ResourcePolicy::AttributesValidator`. The validator checks if attributes from the `some_params` satisfy access level conditions (such as `:write`). It adds an error for each hash key that does not satisfy policy conditions.
37
37
 
38
+ ## Usage example using proc
39
+
40
+ ```ruby
41
+ class SomeClass < ActiveRecord::Base
42
+ validates :some_policy, 'resource_policy/attributes': { apply_to: :some_params, allowed_to: -> { custom_allowed_to } }
43
+
44
+ def some_policy
45
+ SomePolicy.new
46
+ end
47
+
48
+ def some_params
49
+ { foo: :foo, bar: :bar }
50
+ end
51
+
52
+ def custom_allowed_to
53
+ new_record? :write : :change
54
+ end
55
+ end
56
+
57
+ some_object = SomeClass.new
58
+ if some_object.valid?
59
+ # No validation errors, continue with the process
60
+ else
61
+ some_object.errors.messages # => { foo: ['attribute action "write" is not allowed'], bar: ['attribute action "write" is not allowed'] }
62
+ end
63
+
64
+ new_object = SomeClass.new
65
+ new_object.valid?
66
+ new_object.errors.messages # => { foo: ['attribute action "write" is not allowed'], bar: ['attribute action "write" is not allowed'] }
67
+
68
+ existing_object = SomeClass.find(1)
69
+ existing_object.valid?
70
+ existing_object.errors.messages # => { foo: ['attribute action "change" is not allowed'], bar: ['attribute action "change" is not allowed'] }
71
+ ```
72
+
73
+ In this example, the `SomeClass` has an attribute named `some_policy` which is being validated using the `ResourcePolicy::AttributesValidator`. The validator checks if attributes from the `some_params` satisfy access level conditions (such as `:write`). It adds an error for each hash key that does not satisfy policy conditions.
74
+
75
+ In this example, the `SomeClass` has an attribute named `some_policy` which is validated using the `ResourcePolicy::ActionValidator`. The validator calls `custom_allowed_to` method on our model to determine which access level to use. If record is new, it will check policy attributes for the `:write` access. If the record saved, it will check policy attributes for `:change` access level. It adds an error for each hash key that does not satisfy policy conditions.
@@ -13,14 +13,14 @@ class UserPolicy
13
13
  policy do |c|
14
14
  c.policy_target :user
15
15
 
16
- c.action(:read).allowed(if: :readable?)
16
+ c.action(:show).allowed(if: :readable?)
17
17
 
18
- c.attribute(:first_name)
18
+ c.attribute(:email)
19
19
  .allowed(:read, if: :readable?)
20
20
  .allowed(:write, if: :writable?)
21
21
  end
22
22
 
23
- def initialize(user, current_user:)
23
+ def initialize(user, current_user)
24
24
  @user = user
25
25
  @current_user = current_user
26
26
  end
@@ -75,11 +75,11 @@ class UserPolicy
75
75
  include ResourcePolicy::Policy
76
76
 
77
77
  policy do |c|
78
- c.action(:read).allowed # current_user can always see user
79
- c.action(:write).allowed(if: :admin?) # only admin current_user can update user
78
+ c.action(:show).allowed # current_user can always see user
79
+ c.action(:update).allowed(if: :admin?) # only admin current_user can update user
80
80
  end
81
81
 
82
- def initialize(user, current_user:)
82
+ def initialize(user, current_user)
83
83
  @user = user
84
84
  @current_user = current_user
85
85
  end
@@ -95,9 +95,9 @@ end
95
95
  then we can check each action like this:
96
96
 
97
97
  ```ruby
98
- policy = UserPolicy.new(user, current_user: current_user)
99
- policy.action(:read).allowed? # => true
100
- policy.action(:write).allowed? # ... depends on `admin?` result
98
+ policy = UserPolicy.new(user, current_user)
99
+ policy.action(:show).allowed? # => true
100
+ policy.action(:update).allowed? # ... depends on `admin?` result
101
101
  ```
102
102
 
103
103
  ## Policy#actions_policy
@@ -105,12 +105,30 @@ policy.action(:write).allowed? # ... depends on `admin?` result
105
105
  Another way to check each action is to use `actions_policy` object like this:
106
106
 
107
107
  ```ruby
108
- policy = UserPolicy.new(user, current_user: current_user)
108
+ policy = UserPolicy.new(user, current_user)
109
109
  actions_policy = policy.actions_policy
110
110
  actions_policy.read.allowed? # => true
111
111
  actions_policy.write.allowed? # ... depends on `admin?` result
112
112
  ```
113
113
 
114
+ In order to get all actions do:
115
+
116
+ ```ruby
117
+ policy = UserPolicy.new(user, current_user)
118
+ actions_policy = policy.actions_policy
119
+
120
+ actions_policy.actions
121
+ ```
122
+
123
+ In order to get all only allowed action names do:
124
+
125
+ ```ruby
126
+ policy = UserPolicy.new(user, current_user)
127
+ actions_policy = policy.actions_policy
128
+
129
+ actions_policy.allowed_action_names
130
+ ```
131
+
114
132
  ## Usage of Policy#attribute
115
133
 
116
134
  Suppose we have policy like this:
@@ -125,7 +143,7 @@ class UserPolicy
125
143
  .allowed(:write, if: :admin?) # only admin current_user can change email
126
144
  end
127
145
 
128
- def initialize(user, current_user:)
146
+ def initialize(user, current_user)
129
147
  @user = user
130
148
  @current_user = current_user
131
149
  end
@@ -141,7 +159,7 @@ end
141
159
  then we can check each attribute like this:
142
160
 
143
161
  ```ruby
144
- policy = UserPolicy.new(user, current_user: current_user)
162
+ policy = UserPolicy.new(user, current_user)
145
163
  policy.attribute(:email).allowed_to?(:change) # => false - no such rule
146
164
  policy.attribute(:email).readable? # => true
147
165
  policy.attribute(:email).writable? # ... depends on `admin?` result
@@ -152,7 +170,7 @@ policy.attribute(:email).writable? # ... depends on `admin?` result
152
170
  Another way to check each action is to use `attributes_policy` object like this:
153
171
 
154
172
  ```ruby
155
- policy = UserPolicy.new(user, current_user: current_user)
173
+ policy = UserPolicy.new(user, current_user)
156
174
  attributes_policy = policy.attributes_policy
157
175
 
158
176
  attributes_policy.email.allowed_to?(:change) # => false - no such rule
@@ -160,6 +178,16 @@ attributes_policy.email.readable? # same as `allowed_to?(:read)`
160
178
  attributes_policy.email.writable? # same as `allowed_to?(:write)`
161
179
  ```
162
180
 
181
+ In order to get all allowed attributes do:
182
+
183
+ ```ruby
184
+ policy = UserPolicy.new(user, current_user)
185
+ attributes_policy = policy.attributes_policy
186
+
187
+ readable_attributes = attributes_policy.all_allowed_to(:read)
188
+ writable_attributes = attributes_policy.all_allowed_to(:write)
189
+ ```
190
+
163
191
  ## Usage of Policy#protected_resource
164
192
 
165
193
  Policy provides `#protected_resource` method which returns wrapped model instance and does not allow to view fields which current_user does not have access to. You must define `policy_target` in order to be able to use `protected_resource` feature
@@ -176,7 +204,7 @@ class UserPolicy
176
204
  c.attribute(:salary).allowed(:read, if: :admin?) # only visible to admin
177
205
  end
178
206
 
179
- def initialize(user, current_user:)
207
+ def initialize(user, current_user)
180
208
  @user = user
181
209
  @current_user = current_user
182
210
  end
@@ -196,7 +224,7 @@ user = User.find(1337)
196
224
  user.id #=> 1337
197
225
  user.email #=> "john.doe@example.com"
198
226
 
199
- policy = UserPolicy.new(user, current_user: current_user)
227
+ policy = UserPolicy.new(user, current_user)
200
228
  policy.protected_resource.id #=> 1337
201
229
  policy.protected_resource.email # nil
202
230
  ```
@@ -18,6 +18,14 @@ module ResourcePolicy
18
18
  policy_item(method_name.to_sym)
19
19
  end
20
20
 
21
+ def actions
22
+ config.actions.keys.map { |name| policy_item(name.to_sym) }
23
+ end
24
+
25
+ def allowed_action_names
26
+ actions.select(&:allowed?).map(&:name)
27
+ end
28
+
21
29
  def respond_to_missing?(method_name, *args)
22
30
  config.actions.key?(method_name.to_sym) || super
23
31
  end
@@ -13,9 +13,7 @@ module ResourcePolicy
13
13
  end
14
14
 
15
15
  def all
16
- @all ||= config.attributes.keys.map do |attribute_name|
17
- policy_item(attribute_name)
18
- end
16
+ @all ||= config.attributes.values.map { |attribute| policy_item(attribute) }
19
17
  end
20
18
 
21
19
  def all_allowed_to(status)
@@ -23,13 +21,14 @@ module ResourcePolicy
23
21
  end
24
22
 
25
23
  def method_missing(method_name)
26
- return super unless config.attributes.key?(method_name.to_sym)
24
+ attribute = config.configured_attribute(method_name)
25
+ return super unless attribute
27
26
 
28
- policy_item(method_name.to_sym)
27
+ policy_item(attribute)
29
28
  end
30
29
 
31
30
  def respond_to_missing?(method_name, *args)
32
- config.attributes.key?(method_name.to_sym) || super
31
+ !config.configured_attribute(method_name).nil? || super
33
32
  end
34
33
 
35
34
  private
@@ -40,11 +39,8 @@ module ResourcePolicy
40
39
  policy.class.policy
41
40
  end
42
41
 
43
- def policy_item(name)
44
- @policy_item_by_name[name] ||= begin
45
- attribute = config.attributes.fetch(name)
46
- AttributePolicy.new(attribute, policy: policy)
47
- end
42
+ def policy_item(attribute)
43
+ @policy_item_by_name[attribute.name] ||= AttributePolicy.new(attribute, policy: policy)
48
44
  end
49
45
  end
50
46
  end
@@ -46,6 +46,12 @@ module ResourcePolicy
46
46
  @attributes.select { |_name, action| action.configured? }
47
47
  end
48
48
 
49
+ # Same as `attributes[attribute_name.to_sym]`, without building the whole hash on every read.
50
+ def configured_attribute(attribute_name)
51
+ attribute = @attributes[attribute_name.to_sym]
52
+ attribute if attribute&.configured?
53
+ end
54
+
49
55
  def actions
50
56
  @actions.select { |_name, action| action.configured? }
51
57
  end
@@ -24,16 +24,12 @@ module ResourcePolicy
24
24
  attr_reader :policy
25
25
 
26
26
  def target_respond_to?(method_name, *args)
27
- accessible_attributes.include?(method_name.to_sym) &&
28
- policy_target.respond_to?(method_name, *args)
27
+ readable_attribute?(method_name) && policy_target.respond_to?(method_name, *args)
29
28
  end
30
29
 
31
- def accessible_attributes
32
- attributes = policy.class.policy.attributes.values.select do |attribute|
33
- attribute.defined_action?(:read)
34
- end
35
-
36
- attributes.map(&:name)
30
+ def readable_attribute?(name)
31
+ attribute = policy.class.policy.configured_attribute(name)
32
+ !attribute.nil? && attribute.defined_action?(:read)
37
33
  end
38
34
 
39
35
  def policy_target
@@ -18,37 +18,54 @@
18
18
  module ResourcePolicy
19
19
  class ActionValidator < ActiveModel::EachValidator
20
20
  def validate_each(record, default_attribute, policy)
21
- attribute = options.fetch(:as, default_attribute)
22
- action_policy = policy.action(action_name)
23
- validate_action_policy(action_policy, record:, attribute:)
21
+ validation_options = validation_options_for(record, default_attribute, policy)
22
+
23
+ validate_action_policy(**validation_options)
24
24
  end
25
25
 
26
26
  private
27
27
 
28
- def validate_action_policy(policy, record:, attribute:)
28
+ def validation_options_for(record, default_attribute, policy)
29
+ attribute = fetch_option_value(:as, record: record) { default_attribute }
30
+ action_name = fetch_option_value(:allowed_to, record: record)
31
+ action_policy = policy.action(action_name)
32
+
33
+ {
34
+ policy: action_policy,
35
+ record: record,
36
+ attribute: attribute,
37
+ action_name: action_name
38
+ }
39
+ end
40
+
41
+ def validate_action_policy(policy:, record:, attribute:, action_name:)
29
42
  if policy.nil?
30
- add_missing_policy_error_for(record, attribute:)
43
+ add_missing_policy_error_for(record, attribute, action_name)
31
44
  elsif !policy.allowed?
32
- add_not_permitted_error_for(record, attribute:)
45
+ add_not_permitted_error_for(record, attribute, action_name)
33
46
  end
34
47
  end
35
48
 
36
- def action_name
37
- @action_name ||= options.fetch(:allowed_to)
38
- end
39
-
40
- def add_missing_policy_error_for(record, attribute:)
49
+ def add_missing_policy_error_for(record, attribute, action_name)
41
50
  record.errors.add(
42
51
  attribute,
43
52
  "does not have #{action_name.to_s.inspect} action policy defined"
44
53
  )
45
54
  end
46
55
 
47
- def add_not_permitted_error_for(record, attribute:)
56
+ def add_not_permitted_error_for(record, attribute, action_name)
48
57
  record.errors.add(
49
58
  attribute,
50
59
  "action #{action_name.to_s.inspect} is not allowed"
51
60
  )
52
61
  end
62
+
63
+ def fetch_option_value(key, record:, &block)
64
+ value = options.fetch(key, &block)
65
+
66
+ return record.instance_exec(&value) if value.is_a?(Proc)
67
+
68
+ value
69
+ end
53
70
  end
54
71
  end
@@ -40,14 +40,17 @@ module ResourcePolicy
40
40
 
41
41
  def validate_attribute_policy(attribute_policy, record:, hash_attribute:)
42
42
  if attribute_policy.nil?
43
- add_missing_policy_error_for(record, attribute: hash_attribute)
44
- elsif !attribute_policy.allowed_to?(access_level)
45
- add_not_permitted_error_for(record, attribute: hash_attribute)
43
+ return add_missing_policy_error_for(record, attribute: hash_attribute)
44
+ end
45
+
46
+ access_level = access_level_for(record)
47
+ if !attribute_policy.allowed_to?(access_level)
48
+ return add_not_permitted_error_for(record, attribute: hash_attribute)
46
49
  end
47
50
  end
48
51
 
49
- def access_level
50
- @access_level ||= options.fetch(:allowed_to)
52
+ def access_level_for(record)
53
+ fetch_option_value(:allowed_to, record: record)
51
54
  end
52
55
 
53
56
  def hash_value_for(record)
@@ -61,8 +64,16 @@ module ResourcePolicy
61
64
  def add_not_permitted_error_for(record, attribute:)
62
65
  record.errors.add(
63
66
  attribute,
64
- "attribute action #{access_level.to_s.inspect} is not allowed"
67
+ "attribute action #{access_level_for(record).to_s.inspect} is not allowed"
65
68
  )
66
69
  end
70
+
71
+ def fetch_option_value(key, record:, &block)
72
+ value = options.fetch(key, &block)
73
+
74
+ return record.instance_exec(&value) if value.is_a?(Proc)
75
+
76
+ value
77
+ end
67
78
  end
68
79
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ResourcePolicy
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
5
  end
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
36
  spec.require_paths = ['lib']
37
37
 
38
- spec.add_development_dependency 'bundler', '~> 2.0'
38
+ spec.add_development_dependency 'bundler', '~> 4.0'
39
39
  spec.add_development_dependency 'pry-byebug'
40
40
  spec.add_development_dependency 'rake', '~> 13.0'
41
41
  spec.add_development_dependency 'rspec', '~> 3.0'
@@ -43,5 +43,5 @@ Gem::Specification.new do |spec|
43
43
  spec.add_development_dependency 'rubocop-performance'
44
44
  spec.add_development_dependency 'rubocop-rails'
45
45
  spec.add_development_dependency 'rubocop-rspec'
46
- spec.add_development_dependency 'rails', '~> 7.0.0'
46
+ spec.add_development_dependency 'rails', '~> 8.0.0'
47
47
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resource_policy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Povilas Jurcys
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-02-02 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '2.0'
18
+ version: '4.0'
20
19
  type: :development
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '2.0'
25
+ version: '4.0'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: pry-byebug
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -128,15 +127,14 @@ dependencies:
128
127
  requirements:
129
128
  - - "~>"
130
129
  - !ruby/object:Gem::Version
131
- version: 7.0.0
130
+ version: 8.0.0
132
131
  type: :development
133
132
  prerelease: false
134
133
  version_requirements: !ruby/object:Gem::Requirement
135
134
  requirements:
136
135
  - - "~>"
137
136
  - !ruby/object:Gem::Version
138
- version: 7.0.0
139
- description:
137
+ version: 8.0.0
140
138
  email:
141
139
  - po.jurcys@gmail.com
142
140
  executables: []
@@ -149,7 +147,6 @@ files:
149
147
  - ".rspec"
150
148
  - ".rubocop.yml"
151
149
  - ".ruby-version"
152
- - ".travis.yml"
153
150
  - CHANGELOG.md
154
151
  - CODE_OF_CONDUCT.md
155
152
  - Gemfile
@@ -191,8 +188,7 @@ licenses:
191
188
  metadata:
192
189
  homepage_uri: https://github.com/samesystem/resource_policy
193
190
  source_code_uri: https://github.com/samesystem/resource_policy
194
- changelog_uri: https://github.com/samesystem/resource_policy/blob/v1.1.0/CHANGELOG.md
195
- post_install_message:
191
+ changelog_uri: https://github.com/samesystem/resource_policy/blob/v1.2.0/CHANGELOG.md
196
192
  rdoc_options: []
197
193
  require_paths:
198
194
  - lib
@@ -207,8 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
203
  - !ruby/object:Gem::Version
208
204
  version: '0'
209
205
  requirements: []
210
- rubygems_version: 3.3.7
211
- signing_key:
206
+ rubygems_version: 4.0.16
212
207
  specification_version: 4
213
208
  summary: Access control for single resource and it's methods
214
209
  test_files: []
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.6.1
7
- before_install: gem install bundler -v 2.0.1