forest_liana 6.4.0 → 6.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13952d2e70b5b32f326839ad76067ec236adda426152fd116e4836141d92efc7
4
- data.tar.gz: '026179b31057b1ce2bb8b60f6bae5a529467941d27a57c12a897028f4ce8d7bc'
3
+ metadata.gz: 56720f9edd9f48712a65f46e41447785aa04772b3de3f0ef959faea901a3fd97
4
+ data.tar.gz: 4b26438ea7fb4a2cc807c35c29366697650fe27c11963cf177f631d13b953918
5
5
  SHA512:
6
- metadata.gz: '04698769547e0fd18c1720bf247365e6631ac8ef1715967932ab65d01dc9baef9086d017d5623c080cef6b11b72c4e50d4163584b3e6c89538b2fc85bb77cffe'
7
- data.tar.gz: 021f90c8f6ec1962d7761503554e92274d4eb48c6071ab00127cd5fb44ec7243a66d44069d3eafface9ac09b81a5f545fe93b0bb7f92ac2bfeb857622ec688fc
6
+ metadata.gz: 0ba707e8b91588054a0c38de31dc9a02ed5603d0b164ca8040bbe97b08dd426493795dfe283f8af0c49d2ebef73f9c64ff3d18a07e01038cea1ee371ff35286e
7
+ data.tar.gz: da40468756bdb066b0c45a400e35bab3e2c2846b38efe773dfaae5e3b48b453d9e9a2451fd532702c0d032027bf03541d0151c3ee85f27827a8deed3a7d1131f
@@ -57,11 +57,8 @@ module ForestLiana
57
57
 
58
58
  # smart action permissions are retrieved from the action's endpoint and http_method
59
59
  def get_smart_action_request_info
60
- endpoint = request.fullpath
61
- # Trim starting '/'
62
- endpoint[0] = '' if endpoint[0] == '/'
63
60
  {
64
- endpoint: endpoint,
61
+ endpoint: request.fullpath,
65
62
  http_method: request.request_method
66
63
  }
67
64
  end
@@ -92,6 +92,7 @@ module ForestLiana
92
92
  end
93
93
  end
94
94
 
95
+ @apimap['meta']['stack'] = reorder_keys_basic(@apimap['meta']['stack'])
95
96
  @apimap['meta'] = reorder_keys_basic(@apimap['meta'])
96
97
  @apimap
97
98
  rescue => exception
@@ -23,7 +23,7 @@ module ForestLiana
23
23
  end
24
24
 
25
25
  def perform
26
- value = get_resource().eager_load(@includes)
26
+ value = get_resource().joins(@includes)
27
27
 
28
28
  unless @params[:filters].blank?
29
29
  value = FiltersParser.new(@params[:filters], value, @params[:timezone]).apply_filters
@@ -177,7 +177,7 @@ module ForestLiana
177
177
  return false unless pool_permissions
178
178
 
179
179
  # NOTICE: equivalent to Object.values in js & removes nil values
180
- array_permission_infos = @query_request_info.values.filter_map{ |x| x unless x.nil? }
180
+ array_permission_infos = @query_request_info.values.select{ |x| !x.nil? }
181
181
 
182
182
  # NOTICE: Is there any pool_permissions containing the array_permission_infos
183
183
  return pool_permissions.any? {
@@ -19,6 +19,7 @@ module ForestLiana
19
19
  first_name: user['first_name'],
20
20
  last_name: user['last_name'],
21
21
  team: user['teams'][0],
22
+ role: user['role'],
22
23
  rendering_id: rendering_id,
23
24
  exp: expiration_in_seconds()
24
25
  }, ForestLiana.auth_secret, 'HS256')
@@ -6,7 +6,7 @@ module ForestLiana
6
6
 
7
7
  return nil unless collection
8
8
 
9
- collection.actions.find { |action| action.endpoint == endpoint && action.http_method == http_method }
9
+ collection.actions.find { |action| (action.endpoint == endpoint || "/#{action.endpoint}" == endpoint) && action.http_method == http_method }
10
10
  end
11
11
  end
12
12
  end
@@ -203,10 +203,12 @@ module ForestLiana
203
203
 
204
204
  def setup_forest_liana_meta
205
205
  ForestLiana.meta = {
206
- database_type: database_type,
207
206
  liana: 'forest-rails',
208
207
  liana_version: ForestLiana::VERSION,
209
- orm_version: Gem.loaded_specs["activerecord"].version.version
208
+ stack: {
209
+ database_type: database_type,
210
+ orm_version: Gem.loaded_specs["activerecord"].version.version,
211
+ }
210
212
  }
211
213
  end
212
214
 
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "6.4.0"
2
+ VERSION = "6.6.1"
3
3
  end
@@ -0,0 +1,12 @@
1
+ module ForestLiana
2
+ describe Bootstrapper do
3
+ describe 'setup_forest_liana_meta' do
4
+ it "should put statistic data related to user stack on a dedicated object" do
5
+ expect(ForestLiana.meta[:stack])
6
+ .to include(:orm_version)
7
+ expect(ForestLiana.meta[:stack])
8
+ .to include(:database_type)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -45,7 +45,7 @@ describe "Authentications", type: :request do
45
45
 
46
46
  describe "GET /authentication/callback" do
47
47
  before() do
48
- response = '{"data":{"id":666,"attributes":{"first_name":"Alice","last_name":"Doe","email":"alice@forestadmin.com","teams":[1,2,3]}}}'
48
+ response = '{"data":{"id":666,"attributes":{"first_name":"Alice","last_name":"Doe","email":"alice@forestadmin.com","teams":[1,2,3],"role":"Test"}}}'
49
49
  allow(ForestLiana::ForestApiRequester).to receive(:get).with(
50
50
  "/liana/v2/renderings/42/authorization", { :headers => { "forest-token" => "THE-ACCESS-TOKEN" }, :query=> {} }
51
51
  ).and_return(
@@ -72,6 +72,7 @@ describe "Authentications", type: :request do
72
72
  "first_name" => 'Alice',
73
73
  "last_name" => 'Doe',
74
74
  "team" => 1,
75
+ "role" => "Test",
75
76
  }
76
77
 
77
78
  expect(decoded).to include(expected_token_data)
@@ -4,9 +4,11 @@ module ForestLiana
4
4
  context 'on a disordered apimap' do
5
5
  apimap = {
6
6
  'meta': {
7
- 'orm_version': '4.34.9',
7
+ stack: {
8
+ 'orm_version': '4.34.9',
9
+ 'database_type': 'postgresql',
10
+ },
8
11
  'liana_version': '1.5.24',
9
- 'database_type': 'postgresql',
10
12
  liana: 'forest-rails',
11
13
  },
12
14
  'data': [{
@@ -165,8 +167,8 @@ module ForestLiana
165
167
  end
166
168
 
167
169
  it 'should sort the meta values' do
168
- expect(apimap_sorted['meta'].keys).to eq(
169
- ['database_type', 'liana', 'liana_version', 'orm_version'])
170
+ expect(apimap_sorted['meta'].keys).to eq(['liana', 'liana_version', 'stack'])
171
+ expect(apimap_sorted['meta']['stack'].keys).to eq(['database_type', 'orm_version'])
170
172
  end
171
173
  end
172
174
  end
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: 6.4.0
4
+ version: 6.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-26 00:00:00.000000000 Z
11
+ date: 2021-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -371,6 +371,7 @@ files:
371
371
  - spec/helpers/forest_liana/is_same_data_structure_helper_spec.rb
372
372
  - spec/helpers/forest_liana/query_helper_spec.rb
373
373
  - spec/helpers/forest_liana/schema_helper_spec.rb
374
+ - spec/lib/forest_liana/bootstrapper_spec.rb
374
375
  - spec/rails_helper.rb
375
376
  - spec/requests/actions_controller_spec.rb
376
377
  - spec/requests/authentications_spec.rb
@@ -663,6 +664,7 @@ test_files:
663
664
  - spec/dummy/app/models/location.rb
664
665
  - spec/dummy/app/models/island.rb
665
666
  - spec/dummy/app/models/reference.rb
667
+ - spec/lib/forest_liana/bootstrapper_spec.rb
666
668
  - spec/rails_helper.rb
667
669
  - spec/requests/stats_spec.rb
668
670
  - spec/requests/resources_spec.rb