cancancan 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cancan/model_adapters/conditions_normalizer.rb +5 -1
- data/lib/cancan/rule.rb +7 -5
- data/lib/cancan/version.rb +1 -1
- metadata +15 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0fb1ea8821029ab1e070299caac458325635748b3051e1f08999176ec81e29d
|
4
|
+
data.tar.gz: 20a2d023ab68fdf8392d57cc0d32a95d5d904d2bac67c60850d8339524e48de6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 983f4b45a5c32972bca59adb1a0a2591352ba571fb3d95a13c91c40b719828507611ab7c3695ff94bcc07ae8599cac95d1bab8e4bcbad9fd9250bc20e22d9b9c
|
7
|
+
data.tar.gz: 626e5e82e569b68383eb63a605983f92276540f3a20abd35e1fb1a79876880a8b533296382ddef27caa9e7cad3fa28bdd885dd77e87680b32aa70cc38592c256
|
@@ -31,7 +31,7 @@ module CanCan
|
|
31
31
|
raise WrongAssociationName, "Association '#{key}' not defined in model '#{model_class.name}'"
|
32
32
|
end
|
33
33
|
|
34
|
-
if reflection
|
34
|
+
if normalizable_association? reflection
|
35
35
|
key = reflection.options[:through]
|
36
36
|
value = { reflection.source_reflection_name => value }
|
37
37
|
reflection = model_class.reflect_on_association(key)
|
@@ -39,6 +39,10 @@ module CanCan
|
|
39
39
|
|
40
40
|
{ key => normalize_conditions(reflection.klass.name.constantize, value) }
|
41
41
|
end
|
42
|
+
|
43
|
+
def normalizable_association?(reflection)
|
44
|
+
reflection.options[:through].present? && !reflection.options[:source_type].present?
|
45
|
+
end
|
42
46
|
end
|
43
47
|
end
|
44
48
|
end
|
data/lib/cancan/rule.rb
CHANGED
@@ -34,11 +34,13 @@ module CanCan
|
|
34
34
|
def inspect
|
35
35
|
repr = "#<#{self.class.name}"
|
36
36
|
repr += "#{@base_behavior ? 'can' : 'cannot'} #{@actions.inspect}, #{@subjects.inspect}, #{@attributes.inspect}"
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
|
38
|
+
if with_scope?
|
39
|
+
repr += ", #{@conditions.where_values_hash}"
|
40
|
+
elsif [Hash, String].include?(@conditions.class)
|
41
|
+
repr += ", #{@conditions.inspect}"
|
42
|
+
end
|
43
|
+
|
42
44
|
repr + '>'
|
43
45
|
end
|
44
46
|
|
data/lib/cancan/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cancancan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Rodi (Renuo AG)
|
@@ -11,28 +11,28 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2020-01-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: appraisal
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
|
-
- - "~>"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '2.0'
|
23
20
|
- - ">="
|
24
21
|
- !ruby/object:Gem::Version
|
25
22
|
version: 2.0.0
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '2.0'
|
26
26
|
type: :development
|
27
27
|
prerelease: false
|
28
28
|
version_requirements: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- - "~>"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '2.0'
|
33
30
|
- - ">="
|
34
31
|
- !ruby/object:Gem::Version
|
35
32
|
version: 2.0.0
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '2.0'
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,22 +71,22 @@ dependencies:
|
|
71
71
|
name: rspec
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "~>"
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '3.2'
|
77
74
|
- - ">="
|
78
75
|
- !ruby/object:Gem::Version
|
79
76
|
version: 3.2.0
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '3.2'
|
80
80
|
type: :development
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- - "~>"
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
version: '3.2'
|
87
84
|
- - ">="
|
88
85
|
- !ruby/object:Gem::Version
|
89
86
|
version: 3.2.0
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.2'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: rubocop
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,8 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
164
|
-
|
165
|
-
rubygems_version: 2.7.6
|
164
|
+
rubygems_version: 3.0.6
|
166
165
|
signing_key:
|
167
166
|
specification_version: 4
|
168
167
|
summary: Simple authorization solution for Rails.
|