forest_liana 8.0.2 → 8.0.4
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: 6cb3c745a093695e57f53f6c1202de72a1e4ff4610674cb131f65a8981acf2de
|
4
|
+
data.tar.gz: 1e9f488b231111756184fd91b70196b5f852b74530ada7ed04528c03fee31792
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 578322489d3d8dd6526e0c8104617d33c57cfbc45b5b7e37826fbdb2c303b3356376830b3ae7a007e5eaf9cdc194985de3e282e3518d41caa809e2c59fcce0d9
|
7
|
+
data.tar.gz: 9f9ac533509a02ed4a47d844b7d9b6882bcada5eab228463a1260fef0456f72118b83cf312ed7b390e4520a29ea0e31767fa8acd20c2dbbc94920c130fcd4f49
|
@@ -13,13 +13,14 @@ module ForestLiana
|
|
13
13
|
|
14
14
|
user_data = get_user_data(user['id'])
|
15
15
|
collections_data = get_collections_permissions_data
|
16
|
+
collection_name = ForestLiana.name_for(collection)
|
16
17
|
|
17
18
|
begin
|
18
|
-
is_allowed = collections_data[
|
19
|
+
is_allowed = collections_data[collection_name][action].include? user_data['roleId']
|
19
20
|
# re-fetch if user permission is not allowed (may have been changed)
|
20
21
|
unless is_allowed
|
21
22
|
collections_data = get_collections_permissions_data(true)
|
22
|
-
is_allowed = collections_data[
|
23
|
+
is_allowed = collections_data[collection_name][action].include? user_data['roleId']
|
23
24
|
end
|
24
25
|
|
25
26
|
is_allowed
|
@@ -29,6 +30,8 @@ module ForestLiana
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def is_smart_action_authorized?(user, collection, parameters, endpoint, http_method)
|
33
|
+
return true unless has_permission_system?
|
34
|
+
|
32
35
|
user_data = get_user_data(user['id'])
|
33
36
|
collections_data = get_collections_permissions_data
|
34
37
|
begin
|
data/lib/forest_liana/version.rb
CHANGED
@@ -312,6 +312,39 @@ describe 'Requesting Actions routes', :type => :request do
|
|
312
312
|
end
|
313
313
|
end
|
314
314
|
|
315
|
+
describe 'calling the action on development environment' do
|
316
|
+
let(:all_records) { false }
|
317
|
+
let(:params) {
|
318
|
+
{
|
319
|
+
data: {
|
320
|
+
attributes: {
|
321
|
+
collection_name: 'Island',
|
322
|
+
ids: ['1'],
|
323
|
+
all_records: all_records,
|
324
|
+
smart_action_id: 'Island-Test'
|
325
|
+
},
|
326
|
+
type: 'custom-action-requests'
|
327
|
+
},
|
328
|
+
timezone: 'Europe/Paris'
|
329
|
+
}
|
330
|
+
}
|
331
|
+
|
332
|
+
it 'should respond 200 and perform the action' do
|
333
|
+
Rails.cache.delete('forest.has_permission')
|
334
|
+
Rails.cache.delete('forest.users')
|
335
|
+
Rails.cache.write('forest.users', {'1' => { 'id' => 1, 'roleId' => 2, 'rendering_id' => '1' }})
|
336
|
+
allow_any_instance_of(ForestLiana::Ability::Fetch)
|
337
|
+
.to receive(:get_permissions)
|
338
|
+
.with('/liana/v4/permissions/environment')
|
339
|
+
.and_return(true)
|
340
|
+
|
341
|
+
post '/forest/actions/test', params: JSON.dump(params), headers: headers
|
342
|
+
|
343
|
+
expect(response.status).to eq(200)
|
344
|
+
expect(JSON.parse(response.body)).to eq({'success' => 'You are OK.'})
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
315
348
|
describe 'calling the action' do
|
316
349
|
before(:each) do
|
317
350
|
allow_any_instance_of(ForestLiana::Ability).to receive(:forest_authorize!) { true }
|
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: 8.0.
|
4
|
+
version: 8.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sandro Munda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|