forest_liana 8.3.0 → 8.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/services/forest_liana/ability/permission.rb +1 -1
- data/lib/forest_liana/version.rb +1 -1
- data/spec/requests/stats_spec.rb +52 -26
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f575399255a09d606c838be6a483b043c8b517eca0a8ccca55c747334555616b
|
4
|
+
data.tar.gz: fbe167b9daa4f6b3d22ddfd58e297cd3da3e020c165a548e37d8ae886c3671ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 025fdca59a9d40cc79221d021f9f64b08aa95ad7cbb7035ee6f1adcc0350c00c7427cd80a25ddaebfe334c48ff83e92a30156709e1ac5a6e3701509b29bae5b9
|
7
|
+
data.tar.gz: 189a32d33adc6f1d898d10328032ae2a3a36da7dfd5be070bd555afba75869b6069ae306bee9d6b9215e55efb7354c11a42092c80811c7c0659fa5e2c021d161
|
@@ -97,7 +97,7 @@ module ForestLiana
|
|
97
97
|
Rails.cache.fetch('forest.stats', expires_in: TTL) do
|
98
98
|
stat_hash = []
|
99
99
|
get_permissions('/liana/v4/permissions/renderings/' + rendering_id)['stats'].each do |stat|
|
100
|
-
stat_hash << "#{stat['type']}:#{Digest::SHA1.hexdigest(stat.
|
100
|
+
stat_hash << "#{stat['type']}:#{Digest::SHA1.hexdigest(stat.deep_sort.to_s)}"
|
101
101
|
end
|
102
102
|
|
103
103
|
stat_hash
|
data/lib/forest_liana/version.rb
CHANGED
data/spec/requests/stats_spec.rb
CHANGED
@@ -2,24 +2,8 @@ require 'rails_helper'
|
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
describe "Stats", type: :request do
|
5
|
-
|
6
|
-
|
7
|
-
id: 1,
|
8
|
-
email: 'michael.kelso@that70.show',
|
9
|
-
first_name: 'Michael',
|
10
|
-
last_name: 'Kelso',
|
11
|
-
team: 'Operations',
|
12
|
-
rendering_id: '1',
|
13
|
-
exp: Time.now.to_i + 2.weeks.to_i,
|
14
|
-
permission_level: 'admin'
|
15
|
-
}, ForestLiana.auth_secret, 'HS256')
|
16
|
-
|
17
|
-
headers = {
|
18
|
-
'Accept' => 'application/json',
|
19
|
-
'Content-Type' => 'application/json',
|
20
|
-
'Authorization' => "Bearer #{token}"
|
21
|
-
}
|
22
|
-
|
5
|
+
let(:rendering_id) { '13' }
|
6
|
+
let(:scopes) { {'scopes' => {}, 'team' => {'id' => '1', 'name' => 'Operations'}} }
|
23
7
|
let(:schema) {
|
24
8
|
[
|
25
9
|
ForestLiana::Model::Collection.new({
|
@@ -30,10 +14,31 @@ describe "Stats", type: :request do
|
|
30
14
|
]
|
31
15
|
}
|
32
16
|
|
17
|
+
let(:token) {
|
18
|
+
JWT.encode({
|
19
|
+
id: 1,
|
20
|
+
email: 'michael.kelso@that70.show',
|
21
|
+
first_name: 'Michael',
|
22
|
+
last_name: 'Kelso',
|
23
|
+
team: 'Operations',
|
24
|
+
rendering_id: rendering_id,
|
25
|
+
exp: Time.now.to_i + 2.weeks.to_i,
|
26
|
+
permission_level: 'user'
|
27
|
+
}, ForestLiana.auth_secret, 'HS256')
|
28
|
+
}
|
29
|
+
|
30
|
+
let(:headers) {
|
31
|
+
{
|
32
|
+
'Accept' => 'application/json',
|
33
|
+
'Content-Type' => 'application/json',
|
34
|
+
'Authorization' => "Bearer #{token}"
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
33
38
|
before do
|
34
39
|
Rails.cache.write('forest.users', {'1' => { 'id' => 1, 'roleId' => 1, 'rendering_id' => '1' }})
|
35
40
|
Rails.cache.write('forest.has_permission', true)
|
36
|
-
allow_any_instance_of(ForestLiana::Ability::
|
41
|
+
allow_any_instance_of(ForestLiana::Ability::Permission)
|
37
42
|
.to receive(:get_permissions)
|
38
43
|
.and_return(
|
39
44
|
{
|
@@ -45,6 +50,31 @@ describe "Stats", type: :request do
|
|
45
50
|
"aggregateFieldName" => nil,
|
46
51
|
"sourceCollectionName" => "Owner"
|
47
52
|
},
|
53
|
+
{
|
54
|
+
"type" => "Objective",
|
55
|
+
"sourceCollectionName" => "Owner",
|
56
|
+
"aggregateFieldName" => nil,
|
57
|
+
"aggregator" => "Count",
|
58
|
+
"objective" => 200,
|
59
|
+
"filter" => nil,
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"type" => "Pie",
|
63
|
+
"sourceCollectionName" => "Owner",
|
64
|
+
"aggregateFieldName" => nil,
|
65
|
+
"groupByFieldName" => "id",
|
66
|
+
"aggregator" => "Count",
|
67
|
+
"filter" => nil,
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"type" => "Line",
|
71
|
+
"sourceCollectionName" => "Owner",
|
72
|
+
"aggregateFieldName" => nil,
|
73
|
+
"groupByFieldName" => "hired_at",
|
74
|
+
"aggregator" => "Count",
|
75
|
+
"timeRange" => "Week",
|
76
|
+
"filter" => nil,
|
77
|
+
},
|
48
78
|
{
|
49
79
|
"type" => "Value",
|
50
80
|
"query" => "SELECT COUNT(*) AS value FROM products;"
|
@@ -53,13 +83,9 @@ describe "Stats", type: :request do
|
|
53
83
|
}
|
54
84
|
)
|
55
85
|
|
56
|
-
ForestLiana::ScopeManager.
|
57
|
-
|
58
|
-
|
59
|
-
:scopes => {}
|
60
|
-
}
|
61
|
-
})
|
62
|
-
|
86
|
+
ForestLiana::ScopeManager.invalidate_scope_cache(rendering_id)
|
87
|
+
allow(ForestLiana::ScopeManager).to receive(:fetch_scopes).and_return(scopes)
|
88
|
+
|
63
89
|
allow(ForestLiana).to receive(:apimap).and_return(schema)
|
64
90
|
allow(ForestLiana::IpWhitelist).to receive(:retrieve) { true }
|
65
91
|
allow(ForestLiana::IpWhitelist).to receive(:is_ip_whitelist_retrieved) { 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.3.
|
4
|
+
version: 8.3.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: 2024-03-
|
11
|
+
date: 2024-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|