forest_liana 9.3.7 → 9.3.8
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: 103afe5988f7c2264d766f270e9fe94acabafd3dff2771616406d24235e178db
|
|
4
|
+
data.tar.gz: 351d284979c39cd903b40f74149bc71a8d4cfde44ec7a9e99f6e12a69a743229
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '099ff2ca0f05fd7ce0a27aa6935ed16ee856559096b0f750b30d30bf3a3c7ea94b6572fec0823381fb17fed5adc719915de86349876b9f861c1184c56ed367cb'
|
|
7
|
+
data.tar.gz: '08c6baba0689e84bb23c7535f9748c25fdabb31ec0ada34a5f61f8c05df3e39cd58038c84cc9279d84fbbcd3b2e85681b0404c555e39bd1fdc971309ff5674dd'
|
|
@@ -16,7 +16,8 @@ module ForestLiana
|
|
|
16
16
|
collection_name = ForestLiana.name_for(collection)
|
|
17
17
|
|
|
18
18
|
begin
|
|
19
|
-
is_allowed = collections_data[collection_name][action].include?
|
|
19
|
+
is_allowed = (collections_data.key?(collection_name) && collections_data[collection_name][action].include?(user_data['roleId']))
|
|
20
|
+
|
|
20
21
|
# re-fetch if user permission is not allowed (may have been changed)
|
|
21
22
|
unless is_allowed
|
|
22
23
|
collections_data = get_collections_permissions_data(true)
|
|
@@ -25,7 +26,7 @@ module ForestLiana
|
|
|
25
26
|
|
|
26
27
|
is_allowed
|
|
27
28
|
rescue
|
|
28
|
-
raise ForestLiana::Errors::ExpectedError.new(409, :conflict, "The collection #{
|
|
29
|
+
raise ForestLiana::Errors::ExpectedError.new(409, :conflict, "The collection #{collection_name} doesn't exist", 'collection not found')
|
|
29
30
|
end
|
|
30
31
|
end
|
|
31
32
|
|
data/lib/forest_liana/version.rb
CHANGED
|
@@ -79,6 +79,7 @@ module ForestLiana
|
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
+
|
|
82
83
|
it 'should throw an exception when the collection doesn\'t exist' do
|
|
83
84
|
expect {dummy_class.is_crud_authorized?('browse', user, String)}.to raise_error(ForestLiana::Errors::ExpectedError, 'The collection String doesn\'t exist')
|
|
84
85
|
end
|
|
@@ -163,6 +164,53 @@ module ForestLiana
|
|
|
163
164
|
expect(dummy_class.is_crud_authorized?('browse', user, Island)).to equal true
|
|
164
165
|
end
|
|
165
166
|
|
|
167
|
+
it 'should re-fetch the permission once when collection_name doesn\'t exist' do
|
|
168
|
+
Rails.cache.write(
|
|
169
|
+
'forest.collections',
|
|
170
|
+
{
|
|
171
|
+
"collections" => {
|
|
172
|
+
"Fake_collection_name" => {
|
|
173
|
+
"collection" => {
|
|
174
|
+
"browseEnabled" => { "roles" => [1] },
|
|
175
|
+
"readEnabled" => { "roles" => [1] },
|
|
176
|
+
"editEnabled" => { "roles" => [1] },
|
|
177
|
+
"addEnabled" => { "roles" => [1] },
|
|
178
|
+
"deleteEnabled" => { "roles" => [1] },
|
|
179
|
+
"exportEnabled" => { "roles" => [1] }
|
|
180
|
+
},
|
|
181
|
+
"actions" => {
|
|
182
|
+
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
allow_any_instance_of(ForestLiana::Ability::Fetch)
|
|
190
|
+
.to receive(:get_permissions)
|
|
191
|
+
.and_return(
|
|
192
|
+
{
|
|
193
|
+
"collections" => {
|
|
194
|
+
"Island" => {
|
|
195
|
+
"collection" => {
|
|
196
|
+
"browseEnabled" => { "roles" => [1] },
|
|
197
|
+
"readEnabled" => { "roles" => [1] },
|
|
198
|
+
"editEnabled" => { "roles" => [1] },
|
|
199
|
+
"addEnabled" => { "roles" => [1] },
|
|
200
|
+
"deleteEnabled" => { "roles" => [1] },
|
|
201
|
+
"exportEnabled" => { "roles" => [1] }
|
|
202
|
+
},
|
|
203
|
+
"actions" => {
|
|
204
|
+
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
expect(dummy_class.is_crud_authorized?('browse', user, Island)).to equal true
|
|
212
|
+
end
|
|
213
|
+
|
|
166
214
|
it 'should return false when user permission is not allowed' do
|
|
167
215
|
Rails.cache.delete('forest.users')
|
|
168
216
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: forest_liana
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 9.3.
|
|
4
|
+
version: 9.3.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sandro Munda
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-06-
|
|
11
|
+
date: 2024-06-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|