cancancan 3.7.0 → 3.7.1
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/cancancan.gemspec +1 -1
- data/lib/cancan/conditions_matcher.rb +6 -1
- data/lib/cancan/version.rb +1 -1
- data/lib/generators/cancan/ability/templates/ability.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2fc535d60bc86d927de5d440cc48a0538756260629c5c63b55249028dc0f5750
|
|
4
|
+
data.tar.gz: c6122db4d687d6d8da0b9732ba4b76ee5bd037ce698f21ea77fd228676223aaf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 72d2feaca94739a094018d15719bc94098a0bf2b9fd686c6c92ccee83b03e767533f2786d5987d89fc98129b29a6737ec8f05516e2556396f14a9b2c89c94c65
|
|
7
|
+
data.tar.gz: 2e70df7d32570fbc601aab8caa83b6bb5b78249b7db6ba436da1cdaf32b6db1e0003fa9267e11060f21675d32fd0cc2e44b807c6cf2850d86295be5d41ae3df0
|
data/cancancan.gemspec
CHANGED
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
|
10
10
|
s.authors = ['Alessandro Rodi (Renuo AG)', 'Bryan Rite', 'Ryan Bates', 'Richard Wilson']
|
|
11
11
|
s.email = 'alessandro.rodi@renuo.ch'
|
|
12
12
|
s.homepage = 'https://github.com/CanCanCommunity/cancancan'
|
|
13
|
-
s.metadata = { 'changelog_uri' => 'https://github.com/CanCanCommunity/cancancan/blob/
|
|
13
|
+
s.metadata = { 'changelog_uri' => 'https://github.com/CanCanCommunity/cancancan/blob/main/CHANGELOG.md',
|
|
14
14
|
'funding_uri' => 'https://github.com/sponsors/coorasse' }
|
|
15
15
|
s.summary = 'Simple authorization solution for Rails.'
|
|
16
16
|
s.description = 'Simple authorization solution for Rails. All permissions are stored in a single location.'
|
|
@@ -105,8 +105,13 @@ module CanCan
|
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
# Like Active Record with a relation as condition value: the selected column, or the primary key, is matched.
|
|
108
|
+
# A record matches the primary key only when it is an instance of the model of the relation, so that a record
|
|
109
|
+
# of another model with the same id, e.g. through a polymorphic association, does not match.
|
|
108
110
|
def relation_match?(attribute, relation)
|
|
109
|
-
relation.
|
|
111
|
+
column = relation.select_values.first
|
|
112
|
+
return false if column.nil? && attribute.is_a?(ActiveRecord::Base) && !attribute.is_a?(relation.klass)
|
|
113
|
+
|
|
114
|
+
relation.where((column || relation.primary_key) => attribute).exists?
|
|
110
115
|
end
|
|
111
116
|
|
|
112
117
|
def hash_condition_match?(attribute, value)
|
data/lib/cancan/version.rb
CHANGED
|
@@ -27,6 +27,6 @@ class Ability
|
|
|
27
27
|
# can :update, Article, published: true
|
|
28
28
|
#
|
|
29
29
|
# See the wiki for details:
|
|
30
|
-
# https://github.com/CanCanCommunity/cancancan/blob/
|
|
30
|
+
# https://github.com/CanCanCommunity/cancancan/blob/main/docs/define_check_abilities.md
|
|
31
31
|
end
|
|
32
32
|
end
|
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.7.
|
|
4
|
+
version: 3.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alessandro Rodi (Renuo AG)
|
|
@@ -144,7 +144,7 @@ homepage: https://github.com/CanCanCommunity/cancancan
|
|
|
144
144
|
licenses:
|
|
145
145
|
- MIT
|
|
146
146
|
metadata:
|
|
147
|
-
changelog_uri: https://github.com/CanCanCommunity/cancancan/blob/
|
|
147
|
+
changelog_uri: https://github.com/CanCanCommunity/cancancan/blob/main/CHANGELOG.md
|
|
148
148
|
funding_uri: https://github.com/sponsors/coorasse
|
|
149
149
|
rdoc_options: []
|
|
150
150
|
require_paths:
|
|
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
160
160
|
- !ruby/object:Gem::Version
|
|
161
161
|
version: '0'
|
|
162
162
|
requirements: []
|
|
163
|
-
rubygems_version:
|
|
163
|
+
rubygems_version: 4.0.16
|
|
164
164
|
specification_version: 4
|
|
165
165
|
summary: Simple authorization solution for Rails.
|
|
166
166
|
test_files: []
|