mongoid_ability 3.0.0 → 3.0.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc805cd65bf9cd6deb5fcf4492704ef31860639789ca5cb49825c4d6cc3b9a74
|
4
|
+
data.tar.gz: 566d6195f97fbe1ce3714a4c3d9831c77ed1aa973a2bf4ed6db223cd8795810d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64306098207ce7c07afd427ace5f710048cfaab63c0dea919df0bfe1c181c75f730edde2bdd3da5b84f6241887b09acd091b487555ba9d6048ca1647fb17dd42
|
7
|
+
data.tar.gz: 802b0005642510a19cab284b15787090656dd96fbafc1c76d783b2d1f8f31c415e441b3934030e4eeb8953990009bfcd52725ea402d019d2eaa412e40bc08133
|
data/CHANGELOG.md
CHANGED
@@ -88,11 +88,15 @@ module CanCan
|
|
88
88
|
condition_rules.reject(&:base_behavior).each_with_object([]) do |rule, res|
|
89
89
|
rule.conditions.each do |key, value|
|
90
90
|
key = id_key if %i[id _id].include?(key.to_sym)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
91
|
+
case value
|
92
|
+
when Regexp then res << { key => { '$not' => value } }
|
93
|
+
else
|
94
|
+
if prev_value = res.detect { |item| item.dig(key, '$nin') }
|
95
|
+
prev_value[key]['$nin'] += Array(value)
|
96
|
+
else
|
97
|
+
res << { key => { '$nin' => Array(value) } }
|
98
|
+
end
|
99
|
+
end
|
96
100
|
end
|
97
101
|
end
|
98
102
|
end
|
@@ -100,6 +104,7 @@ module CanCan
|
|
100
104
|
|
101
105
|
def subject_type_conditions
|
102
106
|
return unless open_subject_types.present?
|
107
|
+
|
103
108
|
{ :"#{type_key}".nin => closed_subject_types.map(&:to_s) }
|
104
109
|
end
|
105
110
|
|
@@ -112,7 +117,7 @@ module CanCan
|
|
112
117
|
def database_records
|
113
118
|
return @model_class.none unless has_any_conditions?
|
114
119
|
|
115
|
-
or_conditions = { '$or' =>
|
120
|
+
or_conditions = { '$or' => [subject_type_conditions, *open_conditions].compact }
|
116
121
|
or_conditions = nil if or_conditions['$or'].empty?
|
117
122
|
|
118
123
|
and_conditions = { '$and' => [or_conditions, *closed_conditions].compact }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_ability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cancancan
|
@@ -207,8 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
requirements: []
|
210
|
-
|
211
|
-
rubygems_version: 2.7.6
|
210
|
+
rubygems_version: 3.0.1
|
212
211
|
signing_key:
|
213
212
|
specification_version: 4
|
214
213
|
summary: Custom Ability class that allows CanCanCan authorization library store permissions
|