cancancan 3.6.1 → 3.6.2
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/lib/cancan/controller_additions.rb +11 -2
- data/lib/cancan/model_adapters/active_record_5_adapter.rb +13 -2
- data/lib/cancan/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f110f791b83ea1cc157fae66dd576a3dae94f60b983d654e8be252cb6c4e8939
|
|
4
|
+
data.tar.gz: cbf9e6c8e6fadca715eeff37cfce3b289550d538e84a5996b4e95aa00632d7fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8102b54914e87e65dbd15b27991e33462d5083d37c6f57aaf09a2dfeaff92826420e27863bd88e17a8c1f18939281ec36ed2abb70e2e012df16661997af5f98a
|
|
7
|
+
data.tar.gz: 6b1defbddb0262274e8ad349fb6b267fa45b4024ca790ba3ba93f67d741cc38055e37e485d57f7ff17b59244a5c235d42e956b9049b603d2d8aa28898a4dd768
|
|
@@ -213,7 +213,7 @@ module CanCan
|
|
|
213
213
|
def skip_load_resource(*args)
|
|
214
214
|
options = args.extract_options!
|
|
215
215
|
name = args.first
|
|
216
|
-
|
|
216
|
+
add_cancan_skip(:load, name, options)
|
|
217
217
|
end
|
|
218
218
|
|
|
219
219
|
# Skip the authorization behavior of CanCan. This is useful when using +load_and_authorize_resource+ but want to
|
|
@@ -229,7 +229,7 @@ module CanCan
|
|
|
229
229
|
def skip_authorize_resource(*args)
|
|
230
230
|
options = args.extract_options!
|
|
231
231
|
name = args.first
|
|
232
|
-
|
|
232
|
+
add_cancan_skip(:authorize, name, options)
|
|
233
233
|
end
|
|
234
234
|
|
|
235
235
|
# Add this to a controller to ensure it performs authorization through +authorize+! or +authorize_resource+ call.
|
|
@@ -295,6 +295,15 @@ module CanCan
|
|
|
295
295
|
def cancan_skipper
|
|
296
296
|
self._cancan_skipper ||= { authorize: {}, load: {} }
|
|
297
297
|
end
|
|
298
|
+
|
|
299
|
+
private
|
|
300
|
+
|
|
301
|
+
# _cancan_skipper is a class_attribute: a subclass shares the hash of its superclass until it assigns
|
|
302
|
+
# its own. Assign a copy, so a skip in a subclass does not change the superclass or sibling classes.
|
|
303
|
+
def add_cancan_skip(behavior, name, options)
|
|
304
|
+
skipper = cancan_skipper
|
|
305
|
+
self._cancan_skipper = skipper.merge(behavior => skipper[behavior].merge(name => options))
|
|
306
|
+
end
|
|
298
307
|
end
|
|
299
308
|
|
|
300
309
|
def self.included(base)
|
|
@@ -49,11 +49,22 @@ module CanCan
|
|
|
49
49
|
def visit_nodes(node)
|
|
50
50
|
# Rails 5.2 adds a BindParam node that prevents the visitor method from properly compiling the SQL query
|
|
51
51
|
if self.class.version_greater_or_equal?('5.2.0')
|
|
52
|
-
connection =
|
|
52
|
+
connection = model_connection
|
|
53
53
|
collector = Arel::Collectors::SubstituteBinds.new(connection, Arel::Collectors::SQLString.new)
|
|
54
54
|
connection.visitor.accept(node, collector).value
|
|
55
55
|
else
|
|
56
|
-
|
|
56
|
+
model_connection.visitor.compile(node)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Rails 7.2 soft-deprecated ActiveRecord::Base.connection in favour of
|
|
61
|
+
# lease_connection, which better describes its lifecycle. Fall back to
|
|
62
|
+
# connection for Rails < 7.2 where lease_connection is not defined.
|
|
63
|
+
def model_connection
|
|
64
|
+
if @model_class.respond_to?(:lease_connection)
|
|
65
|
+
@model_class.lease_connection
|
|
66
|
+
else
|
|
67
|
+
@model_class.send(:connection)
|
|
57
68
|
end
|
|
58
69
|
end
|
|
59
70
|
end
|
data/lib/cancan/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cancancan
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.6.
|
|
4
|
+
version: 3.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alessandro Rodi (Renuo AG)
|
|
8
8
|
- Bryan Rite
|
|
9
9
|
- Ryan Bates
|
|
10
10
|
- Richard Wilson
|
|
11
|
-
autorequire:
|
|
12
11
|
bindir: bin
|
|
13
12
|
cert_chain: []
|
|
14
|
-
date:
|
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
15
14
|
dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
|
17
16
|
name: appraisal
|
|
@@ -157,7 +156,6 @@ licenses:
|
|
|
157
156
|
- MIT
|
|
158
157
|
metadata:
|
|
159
158
|
funding_uri: https://github.com/sponsors/coorasse
|
|
160
|
-
post_install_message:
|
|
161
159
|
rdoc_options: []
|
|
162
160
|
require_paths:
|
|
163
161
|
- lib
|
|
@@ -172,8 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
172
170
|
- !ruby/object:Gem::Version
|
|
173
171
|
version: '0'
|
|
174
172
|
requirements: []
|
|
175
|
-
rubygems_version: 3.
|
|
176
|
-
signing_key:
|
|
173
|
+
rubygems_version: 3.6.9
|
|
177
174
|
specification_version: 4
|
|
178
175
|
summary: Simple authorization solution for Rails.
|
|
179
176
|
test_files: []
|