forest_liana 7.0.0.beta.2 → 7.0.0.beta.3
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 +4 -4
- data/app/controllers/forest_liana/resources_controller.rb +1 -0
- data/app/controllers/forest_liana/smart_actions_controller.rb +1 -4
- data/app/services/forest_liana/apimap_sorter.rb +1 -0
- data/app/services/forest_liana/line_stat_getter.rb +1 -1
- data/app/services/forest_liana/permissions_checker.rb +40 -34
- data/app/services/forest_liana/permissions_formatter.rb +1 -1
- data/app/services/forest_liana/permissions_getter.rb +1 -4
- data/app/services/forest_liana/token.rb +1 -0
- data/app/services/forest_liana/utils/beta_schema_utils.rb +1 -1
- data/lib/forest_liana/bootstrapper.rb +4 -2
- data/lib/forest_liana/version.rb +1 -1
- data/spec/lib/forest_liana/bootstrapper_spec.rb +12 -0
- data/spec/requests/authentications_spec.rb +2 -1
- data/spec/services/forest_liana/apimap_sorter_spec.rb +6 -4
- data/spec/services/forest_liana/permissions_checker_acl_disabled_spec.rb +45 -69
- data/spec/services/forest_liana/permissions_checker_acl_enabled_spec.rb +39 -63
- data/spec/services/forest_liana/permissions_checker_live_queries_spec.rb +3 -3
- data/spec/services/forest_liana/permissions_formatter_spec.rb +11 -11
- metadata +113 -111
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3115af32c59b5bf0e32218f3d40cb661809d58316714654520bde1bfee235098
|
4
|
+
data.tar.gz: 850a6dbc96d8ff1e74ffe7970dc98ff2bd721d6b834087353052208722b55810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea018906c77a41db7a7dc1022cd6485e5f9a293763c1822a64706092f8be74d1046230198af6d0041277cb8f2b852115633b96f622f69a192dc99f911cd31178
|
7
|
+
data.tar.gz: cf12c7f0821b3e9232fe884e3d5c04470f6467d4a571ffc88ce2f6e36c9edac6704dcdd9a0c431dd222435bac1c31b512a5585bc9fb99f141e309e41f9ff8696
|
@@ -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:
|
61
|
+
endpoint: request.fullpath,
|
65
62
|
http_method: request.request_method
|
66
63
|
}
|
67
64
|
end
|
@@ -23,7 +23,7 @@ module ForestLiana
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def perform
|
26
|
-
value = get_resource().
|
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
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module ForestLiana
|
2
2
|
class PermissionsChecker
|
3
3
|
@@permissions_cached = Hash.new
|
4
|
-
@@
|
4
|
+
@@renderings_cached = Hash.new
|
5
5
|
@@roles_acl_activated = false
|
6
|
-
|
6
|
+
|
7
7
|
@@expiration_in_seconds = (ENV['FOREST_PERMISSIONS_EXPIRATION_IN_SECONDS'] || 3600).to_i
|
8
8
|
|
9
|
-
def initialize(resource, permission_name, rendering_id, user_id: nil, smart_action_request_info: nil, collection_list_parameters:
|
9
|
+
def initialize(resource, permission_name, rendering_id, user_id: nil, smart_action_request_info: nil, collection_list_parameters: Hash.new, query_request_info: nil)
|
10
10
|
|
11
11
|
@collection_name = resource.present? ? ForestLiana.name_for(resource) : nil
|
12
12
|
@permission_name = permission_name
|
@@ -39,13 +39,16 @@ module ForestLiana
|
|
39
39
|
permissions['data'] = ForestLiana::PermissionsFormatter.convert_to_new_format(permissions['data'], @rendering_id)
|
40
40
|
@@permissions_cached[@rendering_id] = permissions
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
|
+
# NOTICE: Add stats permissions to the RenderingPermissions
|
44
|
+
permissions['data']['renderings'][@rendering_id]['stats'] = permissions['stats']
|
45
|
+
add_rendering_permissions_to_cache(permissions)
|
43
46
|
end
|
44
47
|
|
45
|
-
def
|
48
|
+
def add_rendering_permissions_to_cache(permissions)
|
46
49
|
permissions['data']['renderings'].keys.each { |rendering_id|
|
47
|
-
@@
|
48
|
-
@@
|
50
|
+
@@renderings_cached[rendering_id] = permissions['data']['renderings'][rendering_id]
|
51
|
+
@@renderings_cached[rendering_id]['last_fetch'] = Time.now
|
49
52
|
} if permissions['data']['renderings']
|
50
53
|
end
|
51
54
|
|
@@ -59,20 +62,17 @@ module ForestLiana
|
|
59
62
|
return stat_with_parameters_allowed?
|
60
63
|
end
|
61
64
|
|
62
|
-
|
63
|
-
|
64
65
|
if permissions && permissions[@collection_name] &&
|
65
66
|
permissions[@collection_name]['collection']
|
66
67
|
if @permission_name === 'actions'
|
67
68
|
return smart_action_allowed?(permissions[@collection_name]['actions'])
|
68
69
|
else
|
69
70
|
if @permission_name === 'browseEnabled'
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
return false unless are_scopes_valid?(scope_permissions)
|
71
|
+
refresh_rendering_cache if rendering_cache_expired?
|
72
|
+
|
73
|
+
# NOTICE: In this case we need to check that that query is allowed
|
74
|
+
if @collection_list_parameters[:segmentQuery].present?
|
75
|
+
return false unless segment_query_allowed?
|
76
76
|
end
|
77
77
|
end
|
78
78
|
return is_user_allowed(permissions[@collection_name]['collection'][@permission_name])
|
@@ -82,23 +82,27 @@ module ForestLiana
|
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
|
-
def
|
86
|
-
@@
|
87
|
-
@@
|
88
|
-
@@
|
85
|
+
def get_segments_in_permissions
|
86
|
+
@@renderings_cached[@rendering_id] &&
|
87
|
+
@@renderings_cached[@rendering_id][@collection_name] &&
|
88
|
+
@@renderings_cached[@rendering_id][@collection_name]['segments']
|
89
89
|
end
|
90
90
|
|
91
|
-
def
|
92
|
-
return true unless @@
|
91
|
+
def rendering_cache_expired?
|
92
|
+
return true unless @@renderings_cached[@rendering_id] && @@renderings_cached[@rendering_id]['last_fetch']
|
93
93
|
|
94
|
-
elapsed_seconds = date_difference_in_seconds(Time.now, @@
|
94
|
+
elapsed_seconds = date_difference_in_seconds(Time.now, @@renderings_cached[@rendering_id]['last_fetch'])
|
95
95
|
elapsed_seconds >= @@expiration_in_seconds
|
96
96
|
end
|
97
97
|
|
98
|
-
# This will happen only on rolesACLActivated (as
|
99
|
-
def
|
98
|
+
# This will happen only on rolesACLActivated (as segments cache will always be up to date on disabled)
|
99
|
+
def refresh_rendering_cache
|
100
100
|
permissions = ForestLiana::PermissionsGetter::get_permissions_for_rendering(@rendering_id, rendering_specific_only: true)
|
101
|
-
|
101
|
+
|
102
|
+
# NOTICE: Add stats permissions to the RenderingPermissions
|
103
|
+
permissions['data']['renderings'][@rendering_id]['stats'] = permissions['stats']
|
104
|
+
|
105
|
+
add_rendering_permissions_to_cache(permissions)
|
102
106
|
end
|
103
107
|
|
104
108
|
# When acl disabled permissions are stored and retrieved by rendering
|
@@ -112,12 +116,12 @@ module ForestLiana
|
|
112
116
|
end
|
113
117
|
|
114
118
|
def get_live_query_permissions_content
|
115
|
-
permissions =
|
119
|
+
permissions = @@renderings_cached[@rendering_id]
|
116
120
|
permissions && permissions['stats'] && permissions['stats']['queries']
|
117
121
|
end
|
118
122
|
|
119
123
|
def get_stat_with_parameters_content(statPermissionType)
|
120
|
-
permissions =
|
124
|
+
permissions = @@renderings_cached[@rendering_id]
|
121
125
|
permissions && permissions['stats'] && permissions['stats'][statPermissionType]
|
122
126
|
end
|
123
127
|
|
@@ -154,11 +158,13 @@ module ForestLiana
|
|
154
158
|
is_user_allowed(smart_action_permissions['triggerEnabled'])
|
155
159
|
end
|
156
160
|
|
157
|
-
def
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
161
|
+
def segment_query_allowed?
|
162
|
+
segments_queries_permissions = get_segments_in_permissions
|
163
|
+
|
164
|
+
return false unless segments_queries_permissions
|
165
|
+
|
166
|
+
# NOTICE: @query_request_info matching an existing segment query
|
167
|
+
return segments_queries_permissions.include? @collection_list_parameters[:segmentQuery]
|
162
168
|
end
|
163
169
|
|
164
170
|
def live_query_allowed?
|
@@ -177,7 +183,7 @@ module ForestLiana
|
|
177
183
|
return false unless pool_permissions
|
178
184
|
|
179
185
|
# NOTICE: equivalent to Object.values in js & removes nil values
|
180
|
-
array_permission_infos = @query_request_info.values.
|
186
|
+
array_permission_infos = @query_request_info.values.select{ |x| !x.nil? }
|
181
187
|
|
182
188
|
# NOTICE: Is there any pool_permissions containing the array_permission_infos
|
183
189
|
return pool_permissions.any? {
|
@@ -201,7 +207,7 @@ module ForestLiana
|
|
201
207
|
# Used only for testing purpose
|
202
208
|
def self.empty_cache
|
203
209
|
@@permissions_cached = Hash.new
|
204
|
-
@@
|
210
|
+
@@renderings_cached = Hash.new
|
205
211
|
@@roles_acl_activated = false
|
206
212
|
@@expiration_in_seconds = (ENV['FOREST_PERMISSIONS_EXPIRATION_IN_SECONDS'] || 3600).to_i
|
207
213
|
end
|
@@ -13,7 +13,7 @@ module ForestLiana
|
|
13
13
|
'actions' => convert_actions_permissions_to_new_format(permissions[collection_name]['actions'])
|
14
14
|
}
|
15
15
|
|
16
|
-
permissions_new_format['renderings'][rendering_id][collection_name] = { '
|
16
|
+
permissions_new_format['renderings'][rendering_id][collection_name] = { 'segments' => permissions[collection_name]['segments'] }
|
17
17
|
}
|
18
18
|
|
19
19
|
permissions_new_format
|
@@ -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
|
-
|
208
|
+
stack: {
|
209
|
+
database_type: database_type,
|
210
|
+
orm_version: Gem.loaded_specs["activerecord"].version.version,
|
211
|
+
}
|
210
212
|
}
|
211
213
|
end
|
212
214
|
|
data/lib/forest_liana/version.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
@@ -75,7 +75,7 @@ module ForestLiana
|
|
75
75
|
"users" => nil
|
76
76
|
},
|
77
77
|
},
|
78
|
-
"
|
78
|
+
"segments" => nil
|
79
79
|
},
|
80
80
|
"no_rights_collection" => {
|
81
81
|
"collection" => {
|
@@ -93,7 +93,7 @@ module ForestLiana
|
|
93
93
|
"users" => nil
|
94
94
|
}
|
95
95
|
},
|
96
|
-
"
|
96
|
+
"segments" => nil
|
97
97
|
},
|
98
98
|
},
|
99
99
|
"meta" => {
|
@@ -146,6 +146,8 @@ module ForestLiana
|
|
146
146
|
|
147
147
|
context 'with permissions coming from 2 different renderings' do
|
148
148
|
let(:collection_name) { 'custom' }
|
149
|
+
|
150
|
+
let(:segments_permissions) { nil }
|
149
151
|
let(:api_permissions_rendering_1) {
|
150
152
|
{
|
151
153
|
"data" => {
|
@@ -160,7 +162,7 @@ module ForestLiana
|
|
160
162
|
"searchToEdit" => true
|
161
163
|
},
|
162
164
|
"actions" => { },
|
163
|
-
"
|
165
|
+
"segments" => segments_permissions
|
164
166
|
},
|
165
167
|
},
|
166
168
|
"meta" => {
|
@@ -190,11 +192,11 @@ module ForestLiana
|
|
190
192
|
end
|
191
193
|
|
192
194
|
|
193
|
-
context '
|
195
|
+
context 'renderings cache' do
|
194
196
|
let(:fake_ressource) { collection_name }
|
195
197
|
let(:rendering_id) { 1 }
|
196
198
|
let(:collection_name) { 'custom' }
|
197
|
-
let(:
|
199
|
+
let(:segments_permissions) { { rendering_id => { 'custom' => nil } } }
|
198
200
|
let(:api_permissions) {
|
199
201
|
{
|
200
202
|
"data" => {
|
@@ -209,7 +211,7 @@ module ForestLiana
|
|
209
211
|
"searchToEdit" => true
|
210
212
|
},
|
211
213
|
"actions" => { },
|
212
|
-
"
|
214
|
+
"segments" => nil
|
213
215
|
},
|
214
216
|
},
|
215
217
|
"meta" => {
|
@@ -217,11 +219,11 @@ module ForestLiana
|
|
217
219
|
}
|
218
220
|
}
|
219
221
|
}
|
220
|
-
let(:
|
222
|
+
let(:api_permissions_rendering_only) {
|
221
223
|
{
|
222
224
|
"data" => {
|
223
225
|
'collections' => { },
|
224
|
-
'renderings' =>
|
226
|
+
'renderings' => segments_permissions
|
225
227
|
},
|
226
228
|
"meta" => {
|
227
229
|
"rolesACLActivated" => false
|
@@ -233,13 +235,13 @@ module ForestLiana
|
|
233
235
|
# clones is called to duplicate the returned value and not use to same (which results in an error
|
234
236
|
# as the permissions is edited through the formatter)
|
235
237
|
allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(rendering_id) { api_permissions.clone }
|
236
|
-
allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(rendering_id, rendering_specific_only: true).and_return(
|
238
|
+
allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(rendering_id, rendering_specific_only: true).and_return(api_permissions_rendering_only)
|
237
239
|
end
|
238
240
|
|
239
241
|
context 'when checking once for authorization' do
|
240
242
|
context 'when checking browseEnabled' do
|
241
243
|
context 'when expiration value is set to its default' do
|
242
|
-
it 'should not call the API to refresh the
|
244
|
+
it 'should not call the API to refresh the renderings cache' do
|
243
245
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
244
246
|
|
245
247
|
expect(ForestLiana::PermissionsGetter).to have_received(:get_permissions_for_rendering).with(rendering_id).once
|
@@ -254,7 +256,7 @@ module ForestLiana
|
|
254
256
|
described_class.empty_cache
|
255
257
|
end
|
256
258
|
|
257
|
-
it 'should call the API to refresh the
|
259
|
+
it 'should call the API to refresh the renderings cache' do
|
258
260
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
259
261
|
|
260
262
|
expect(ForestLiana::PermissionsGetter).to have_received(:get_permissions_for_rendering).with(rendering_id).once
|
@@ -263,7 +265,7 @@ module ForestLiana
|
|
263
265
|
end
|
264
266
|
end
|
265
267
|
|
266
|
-
# Only browse permission requires
|
268
|
+
# Only browse permission requires segments
|
267
269
|
context 'when checking exportEnabled' do
|
268
270
|
context 'when expiration value is set in the past' do
|
269
271
|
before do
|
@@ -273,7 +275,7 @@ module ForestLiana
|
|
273
275
|
end
|
274
276
|
end
|
275
277
|
|
276
|
-
it 'should NOT call the API to refresh the
|
278
|
+
it 'should NOT call the API to refresh the renderings cache' do
|
277
279
|
described_class.new(fake_ressource, 'exportEnabled', rendering_id, user_id: user_id).is_authorized?
|
278
280
|
|
279
281
|
expect(ForestLiana::PermissionsGetter).to have_received(:get_permissions_for_rendering).with(rendering_id).once
|
@@ -284,8 +286,8 @@ module ForestLiana
|
|
284
286
|
|
285
287
|
context 'when checking twice for authorization' do
|
286
288
|
context 'on the same rendering' do
|
287
|
-
context 'when
|
288
|
-
it 'should NOT call the API to refresh the
|
289
|
+
context 'when renderings permission has NOT expired' do
|
290
|
+
it 'should NOT call the API to refresh the renderings permissions' do
|
289
291
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
290
292
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
291
293
|
|
@@ -294,14 +296,14 @@ module ForestLiana
|
|
294
296
|
end
|
295
297
|
end
|
296
298
|
|
297
|
-
context 'when
|
299
|
+
context 'when renderings permission has expired' do
|
298
300
|
before do
|
299
301
|
allow(ENV).to receive(:[]).with('FOREST_PERMISSIONS_EXPIRATION_IN_SECONDS').and_return('-1')
|
300
302
|
# Needed to enforce ENV stub
|
301
303
|
described_class.empty_cache
|
302
304
|
end
|
303
305
|
|
304
|
-
it 'should call the API to refresh the
|
306
|
+
it 'should call the API to refresh the renderings permissions' do
|
305
307
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
306
308
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
307
309
|
|
@@ -313,7 +315,7 @@ module ForestLiana
|
|
313
315
|
|
314
316
|
context 'on two different renderings' do
|
315
317
|
let(:other_rendering_id) { 2 }
|
316
|
-
let(:
|
318
|
+
let(:api_permissions_rendering_only) {
|
317
319
|
{
|
318
320
|
"data" => {
|
319
321
|
'collections' => { },
|
@@ -330,10 +332,10 @@ module ForestLiana
|
|
330
332
|
|
331
333
|
before do
|
332
334
|
allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(other_rendering_id).and_return(api_permissions_copy)
|
333
|
-
allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(other_rendering_id, rendering_specific_only: true).and_return(
|
335
|
+
allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(other_rendering_id, rendering_specific_only: true).and_return(api_permissions_rendering_only)
|
334
336
|
end
|
335
337
|
|
336
|
-
it 'should not call the API to refresh the
|
338
|
+
it 'should not call the API to refresh the rederings permissions' do
|
337
339
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
338
340
|
described_class.new(fake_ressource, 'browseEnabled', other_rendering_id, user_id: user_id).is_authorized?
|
339
341
|
|
@@ -350,7 +352,7 @@ module ForestLiana
|
|
350
352
|
# Resource is only used to retrieve the collection name as it's stubbed it does not
|
351
353
|
# need to be defined
|
352
354
|
let(:fake_ressource) { collection_name }
|
353
|
-
let(:default_rendering_id) {
|
355
|
+
let(:default_rendering_id) { 1 }
|
354
356
|
let(:api_permissions) { default_api_permissions }
|
355
357
|
let(:collection_name) { 'all_rights_collection' }
|
356
358
|
|
@@ -380,14 +382,14 @@ module ForestLiana
|
|
380
382
|
describe 'browseEnabled permission' do
|
381
383
|
let(:collection_name) { 'custom' }
|
382
384
|
subject { described_class.new(fake_ressource, 'browseEnabled', default_rendering_id, user_id: user_id) }
|
383
|
-
let(:
|
385
|
+
let(:segments_permissions) { nil }
|
384
386
|
let(:default_api_permissions) {
|
385
387
|
{
|
386
388
|
"data" => {
|
387
389
|
"custom" => {
|
388
390
|
"collection" => collection_permissions,
|
389
391
|
"actions" => { },
|
390
|
-
"
|
392
|
+
"segments" => segments_permissions
|
391
393
|
},
|
392
394
|
},
|
393
395
|
"meta" => {
|
@@ -480,6 +482,26 @@ module ForestLiana
|
|
480
482
|
end
|
481
483
|
end
|
482
484
|
|
485
|
+
context 'when segments are defined' do
|
486
|
+
let(:segments_permissions) { ['SELECT * FROM products;', 'SELECT * FROM sellers;'] }
|
487
|
+
let(:collection_list_parameters) { { :user_id => "1", :segmentQuery => segmentQuery } }
|
488
|
+
|
489
|
+
context 'when segments are passing validation' do
|
490
|
+
let(:segmentQuery) { 'SELECT * FROM products;' }
|
491
|
+
it 'should return true' do
|
492
|
+
expect(subject.is_authorized?).to be true
|
493
|
+
end
|
494
|
+
end
|
495
|
+
|
496
|
+
context 'when segments are NOT passing validation' do
|
497
|
+
let(:segmentQuery) { 'SELECT * FROM rockets WHERE name = "Starship";' }
|
498
|
+
it 'should return false' do
|
499
|
+
expect(subject.is_authorized?).to be false
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
503
|
+
end
|
504
|
+
|
483
505
|
context 'when user has not the required permission' do
|
484
506
|
let(:collection_permissions) {
|
485
507
|
{
|
@@ -498,52 +520,6 @@ module ForestLiana
|
|
498
520
|
end
|
499
521
|
end
|
500
522
|
|
501
|
-
context 'when scopes are defined' do
|
502
|
-
let(:scope_permissions) { { 'dynamicScopesValues' => {}, 'filter' => { 'aggregator' => 'and', 'conditions' => [condition] } }}
|
503
|
-
let(:collection_list_parameters) { { :user_id => "1", :filters => JSON.generate(condition) } }
|
504
|
-
|
505
|
-
context 'when scopes are passing validation' do
|
506
|
-
context 'when scope value is a string' do
|
507
|
-
let(:condition) { { 'field' => 'field_1', 'operator' => 'equal', 'value' => true } }
|
508
|
-
|
509
|
-
it 'should return true' do
|
510
|
-
expect(subject.is_authorized?).to be true
|
511
|
-
end
|
512
|
-
end
|
513
|
-
|
514
|
-
context 'when scope value is a boolean' do
|
515
|
-
let(:condition) { { 'field' => 'field_1', 'operator' => 'equal', 'value' => 'true' } }
|
516
|
-
|
517
|
-
it 'should return true' do
|
518
|
-
expect(subject.is_authorized?).to be true
|
519
|
-
end
|
520
|
-
end
|
521
|
-
end
|
522
|
-
|
523
|
-
context 'when scopes are NOT passing validation' do
|
524
|
-
let(:condition) { { 'field' => 'field_1', 'operator' => 'equal', 'value' => true } }
|
525
|
-
let(:other_condition) {
|
526
|
-
{
|
527
|
-
aggregator: 'and',
|
528
|
-
conditions: [
|
529
|
-
{ field: 'name', value: 'john', operator: 'equal' },
|
530
|
-
{ field: 'price', value: '2500', operator: 'equal' }
|
531
|
-
]
|
532
|
-
}
|
533
|
-
}
|
534
|
-
let(:collection_list_parameters) {
|
535
|
-
{
|
536
|
-
:user_id => "1",
|
537
|
-
:filters => JSON.generate(other_condition)
|
538
|
-
}
|
539
|
-
}
|
540
|
-
|
541
|
-
|
542
|
-
it 'should return false' do
|
543
|
-
expect(subject.is_authorized?).to be false
|
544
|
-
end
|
545
|
-
end
|
546
|
-
end
|
547
523
|
end
|
548
524
|
end
|
549
525
|
|
@@ -50,7 +50,8 @@ module ForestLiana
|
|
50
50
|
})
|
51
51
|
]
|
52
52
|
}
|
53
|
-
let(:
|
53
|
+
let(:default_rendering_id) { 1 }
|
54
|
+
let(:segments_permissions) { { default_rendering_id => { 'segments' => nil } } }
|
54
55
|
let(:default_api_permissions) {
|
55
56
|
{
|
56
57
|
"data" => {
|
@@ -116,14 +117,16 @@ module ForestLiana
|
|
116
117
|
}
|
117
118
|
},
|
118
119
|
},
|
119
|
-
'renderings' =>
|
120
|
+
'renderings' => segments_permissions
|
121
|
+
},
|
122
|
+
"stats" => {
|
123
|
+
"queries"=>[],
|
120
124
|
},
|
121
125
|
"meta" => {
|
122
126
|
"rolesACLActivated" => true
|
123
127
|
}
|
124
128
|
}
|
125
129
|
}
|
126
|
-
let(:default_rendering_id) { 1 }
|
127
130
|
|
128
131
|
before do
|
129
132
|
allow(ForestLiana).to receive(:apimap).and_return(schema)
|
@@ -174,7 +177,7 @@ module ForestLiana
|
|
174
177
|
end
|
175
178
|
|
176
179
|
let(:collection_name) { 'custom' }
|
177
|
-
let(:
|
180
|
+
let(:segments_permissions) { { default_rendering_id => { 'custom' => nil }, 2 => { 'custom' => nil } } }
|
178
181
|
let(:api_permissions_rendering_1) {
|
179
182
|
{
|
180
183
|
"data" => {
|
@@ -191,7 +194,7 @@ module ForestLiana
|
|
191
194
|
"actions" => { }
|
192
195
|
},
|
193
196
|
},
|
194
|
-
'renderings' =>
|
197
|
+
'renderings' => segments_permissions
|
195
198
|
},
|
196
199
|
"meta" => {
|
197
200
|
"rolesACLActivated" => true
|
@@ -242,10 +245,10 @@ module ForestLiana
|
|
242
245
|
end
|
243
246
|
end
|
244
247
|
|
245
|
-
context '
|
248
|
+
context 'renderings cache' do
|
246
249
|
let(:rendering_id) { 1 }
|
247
250
|
let(:collection_name) { 'custom' }
|
248
|
-
let(:
|
251
|
+
let(:segments_permissions) { { rendering_id => { 'custom' => nil } } }
|
249
252
|
let(:api_permissions) {
|
250
253
|
{
|
251
254
|
"data" => {
|
@@ -262,18 +265,18 @@ module ForestLiana
|
|
262
265
|
"actions" => { }
|
263
266
|
},
|
264
267
|
},
|
265
|
-
'renderings' =>
|
268
|
+
'renderings' => segments_permissions
|
266
269
|
},
|
267
270
|
"meta" => {
|
268
271
|
"rolesACLActivated" => true
|
269
272
|
}
|
270
273
|
}
|
271
274
|
}
|
272
|
-
let(:
|
275
|
+
let(:api_permissions_rendering_only) {
|
273
276
|
{
|
274
277
|
"data" => {
|
275
278
|
'collections' => { },
|
276
|
-
'renderings' =>
|
279
|
+
'renderings' => segments_permissions
|
277
280
|
},
|
278
281
|
"meta" => {
|
279
282
|
"rolesACLActivated" => true
|
@@ -283,13 +286,13 @@ module ForestLiana
|
|
283
286
|
|
284
287
|
before do
|
285
288
|
allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(rendering_id).and_return(api_permissions)
|
286
|
-
allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(rendering_id, rendering_specific_only: true).and_return(
|
289
|
+
allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(rendering_id, rendering_specific_only: true).and_return(api_permissions_rendering_only)
|
287
290
|
end
|
288
291
|
|
289
292
|
context 'when checking once for authorization' do
|
290
293
|
context 'when checking browseEnabled' do
|
291
294
|
context 'when expiration value is set to its default' do
|
292
|
-
it 'should not call the API to refresh the
|
295
|
+
it 'should not call the API to refresh the renderings cache' do
|
293
296
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
294
297
|
|
295
298
|
expect(ForestLiana::PermissionsGetter).to have_received(:get_permissions_for_rendering).with(rendering_id).once
|
@@ -304,7 +307,7 @@ module ForestLiana
|
|
304
307
|
described_class.empty_cache
|
305
308
|
end
|
306
309
|
|
307
|
-
it 'should call the API to refresh the
|
310
|
+
it 'should call the API to refresh the renderings cache' do
|
308
311
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
309
312
|
|
310
313
|
expect(ForestLiana::PermissionsGetter).to have_received(:get_permissions_for_rendering).with(rendering_id).once
|
@@ -313,7 +316,7 @@ module ForestLiana
|
|
313
316
|
end
|
314
317
|
end
|
315
318
|
|
316
|
-
# Only browse permission requires
|
319
|
+
# Only browse permission requires segments
|
317
320
|
context 'when checking exportEnabled' do
|
318
321
|
context 'when expiration value is set in the past' do
|
319
322
|
before do
|
@@ -323,7 +326,7 @@ module ForestLiana
|
|
323
326
|
end
|
324
327
|
end
|
325
328
|
|
326
|
-
it 'should NOT call the API to refresh the
|
329
|
+
it 'should NOT call the API to refresh the rendering cache' do
|
327
330
|
described_class.new(fake_ressource, 'exportEnabled', rendering_id, user_id: user_id).is_authorized?
|
328
331
|
|
329
332
|
expect(ForestLiana::PermissionsGetter).to have_received(:get_permissions_for_rendering).with(rendering_id).once
|
@@ -334,8 +337,8 @@ module ForestLiana
|
|
334
337
|
|
335
338
|
context 'when checking twice for authorization' do
|
336
339
|
context 'on the same rendering' do
|
337
|
-
context 'when
|
338
|
-
it 'should NOT call the API to refresh the
|
340
|
+
context 'when rendering permission has NOT expired' do
|
341
|
+
it 'should NOT call the API to refresh the rendering permissions' do
|
339
342
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
340
343
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
341
344
|
|
@@ -344,14 +347,14 @@ module ForestLiana
|
|
344
347
|
end
|
345
348
|
end
|
346
349
|
|
347
|
-
context 'when
|
350
|
+
context 'when renderings permission has expired' do
|
348
351
|
before do
|
349
352
|
allow(ENV).to receive(:[]).with('FOREST_PERMISSIONS_EXPIRATION_IN_SECONDS').and_return('-1')
|
350
353
|
# Needed to enforce ENV stub
|
351
354
|
described_class.empty_cache
|
352
355
|
end
|
353
356
|
|
354
|
-
it 'should call the API to refresh the
|
357
|
+
it 'should call the API to refresh the rendering permissions' do
|
355
358
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
356
359
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
357
360
|
|
@@ -363,14 +366,17 @@ module ForestLiana
|
|
363
366
|
|
364
367
|
context 'on two different renderings' do
|
365
368
|
let(:other_rendering_id) { 2 }
|
366
|
-
let(:
|
369
|
+
let(:api_permissions_rendering_only) {
|
367
370
|
{
|
368
371
|
"data" => {
|
369
372
|
'collections' => { },
|
370
373
|
'renderings' => {
|
371
|
-
|
374
|
+
other_rendering_id => { 'custom' => nil }
|
372
375
|
}
|
373
376
|
},
|
377
|
+
"stats" => {
|
378
|
+
"somestats" => [],
|
379
|
+
},
|
374
380
|
"meta" => {
|
375
381
|
"rolesACLActivated" => true
|
376
382
|
}
|
@@ -378,10 +384,10 @@ module ForestLiana
|
|
378
384
|
}
|
379
385
|
|
380
386
|
before do
|
381
|
-
allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(other_rendering_id, rendering_specific_only: true).and_return(
|
387
|
+
allow(ForestLiana::PermissionsGetter).to receive(:get_permissions_for_rendering).with(other_rendering_id, rendering_specific_only: true).and_return(api_permissions_rendering_only)
|
382
388
|
end
|
383
389
|
|
384
|
-
it 'should call the API to refresh the
|
390
|
+
it 'should call the API to refresh the rendering permissions' do
|
385
391
|
described_class.new(fake_ressource, 'browseEnabled', rendering_id, user_id: user_id).is_authorized?
|
386
392
|
described_class.new(fake_ressource, 'browseEnabled', other_rendering_id, user_id: user_id).is_authorized?
|
387
393
|
|
@@ -452,58 +458,28 @@ module ForestLiana
|
|
452
458
|
end
|
453
459
|
end
|
454
460
|
|
455
|
-
context 'when
|
461
|
+
context 'when segments are defined' do
|
456
462
|
let(:default_rendering_id) { 1 }
|
457
|
-
let(:
|
463
|
+
let(:segments_permissions) {
|
458
464
|
{
|
459
465
|
default_rendering_id => {
|
460
466
|
collection_name => {
|
461
|
-
'
|
462
|
-
'dynamicScopesValues' => {},
|
463
|
-
'filter' => { 'aggregator' => 'and', 'conditions' => [condition] }
|
464
|
-
}
|
467
|
+
'segments' => ['SELECT * FROM products;', 'SELECT * FROM sellers;']
|
465
468
|
}
|
466
469
|
}
|
467
470
|
}
|
468
471
|
}
|
469
|
-
let(:collection_list_parameters) { { :user_id => "1", :
|
472
|
+
let(:collection_list_parameters) { { :user_id => "1", :segmentQuery => segmentQuery } }
|
470
473
|
|
471
|
-
context 'when
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
it 'should return true' do
|
476
|
-
expect(subject.is_authorized?).to be true
|
477
|
-
end
|
478
|
-
end
|
479
|
-
|
480
|
-
context 'when scope value is a boolean' do
|
481
|
-
let(:condition) { { 'field' => 'field_1', 'operator' => 'equal', 'value' => 'true' } }
|
482
|
-
|
483
|
-
it 'should return true' do
|
484
|
-
expect(subject.is_authorized?).to be true
|
485
|
-
end
|
474
|
+
context 'when segments are passing validation' do
|
475
|
+
let(:segmentQuery) { 'SELECT * FROM products;' }
|
476
|
+
it 'should return true' do
|
477
|
+
expect(subject.is_authorized?).to be true
|
486
478
|
end
|
487
479
|
end
|
488
480
|
|
489
|
-
context 'when
|
490
|
-
let(:
|
491
|
-
let(:other_condition) {
|
492
|
-
{
|
493
|
-
aggregator: 'and',
|
494
|
-
conditions: [
|
495
|
-
{ field: 'name', value: 'john', operator: 'equal' },
|
496
|
-
{ field: 'price', value: '2500', operator: 'equal' }
|
497
|
-
]
|
498
|
-
}
|
499
|
-
}
|
500
|
-
let(:collection_list_parameters) {
|
501
|
-
{
|
502
|
-
:user_id => "1",
|
503
|
-
:filters => JSON.generate(other_condition)
|
504
|
-
}
|
505
|
-
}
|
506
|
-
|
481
|
+
context 'when segments are NOT passing validation' do
|
482
|
+
let(:segmentQuery) { 'SELECT * FROM rockets WHERE name = "Starship";' }
|
507
483
|
it 'should return false' do
|
508
484
|
expect(subject.is_authorized?).to be false
|
509
485
|
end
|
@@ -20,7 +20,8 @@ module ForestLiana
|
|
20
20
|
})
|
21
21
|
]
|
22
22
|
}
|
23
|
-
let(:
|
23
|
+
let(:default_rendering_id) { 1 }
|
24
|
+
let(:segments_permissions) { { default_rendering_id => { 'segments' => nil } } }
|
24
25
|
let(:default_api_permissions) {
|
25
26
|
{
|
26
27
|
"data" => {
|
@@ -41,7 +42,7 @@ module ForestLiana
|
|
41
42
|
}
|
42
43
|
},
|
43
44
|
},
|
44
|
-
'renderings' =>
|
45
|
+
'renderings' => segments_permissions
|
45
46
|
},
|
46
47
|
"meta" => {
|
47
48
|
"rolesACLActivated" => true
|
@@ -61,7 +62,6 @@ module ForestLiana
|
|
61
62
|
},
|
62
63
|
}
|
63
64
|
}
|
64
|
-
let(:default_rendering_id) { 1 }
|
65
65
|
|
66
66
|
before do
|
67
67
|
allow(ForestLiana).to receive(:apimap).and_return(schema)
|
@@ -14,7 +14,7 @@ module ForestLiana
|
|
14
14
|
}
|
15
15
|
}
|
16
16
|
let(:old_format_action_permissions) { { 'allowed' => true, 'users' => nil } }
|
17
|
-
let(:
|
17
|
+
let(:old_format_segments_permissions) { nil }
|
18
18
|
let(:old_format_permissions) {
|
19
19
|
{
|
20
20
|
'collection_1' => {
|
@@ -22,7 +22,7 @@ module ForestLiana
|
|
22
22
|
'actions' => {
|
23
23
|
'action_1' => old_format_action_permissions
|
24
24
|
},
|
25
|
-
'
|
25
|
+
'segments' => old_format_segments_permissions
|
26
26
|
}
|
27
27
|
}
|
28
28
|
}
|
@@ -197,22 +197,22 @@ module ForestLiana
|
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
-
describe '
|
201
|
-
subject { converted_permission['renderings'][rendering_id]['collection_1']['
|
202
|
-
let(:expected_new_format_permissions) {
|
200
|
+
describe 'segments permissions' do
|
201
|
+
subject { converted_permission['renderings'][rendering_id]['collection_1']['segments'] }
|
202
|
+
let(:expected_new_format_permissions) { old_format_segments_permissions }
|
203
203
|
|
204
|
-
context 'when
|
205
|
-
let(:
|
204
|
+
context 'when segments permissions are set' do
|
205
|
+
let(:old_format_segments_permissions) { ['segmentQuery1', 'segmentQuery2'] }
|
206
206
|
|
207
|
-
it 'expected
|
207
|
+
it 'expected segments permissions should be set' do
|
208
208
|
expect(subject).to eq expected_new_format_permissions
|
209
209
|
end
|
210
210
|
end
|
211
211
|
|
212
|
-
context 'when
|
213
|
-
let(:
|
212
|
+
context 'when segments permissions are nil' do
|
213
|
+
let(:old_format_segments_permissions) { nil }
|
214
214
|
|
215
|
-
it 'expected
|
215
|
+
it 'expected segments permissions should be nil' do
|
216
216
|
expect(subject).to eq expected_new_format_permissions
|
217
217
|
end
|
218
218
|
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: 7.0.0.beta.
|
4
|
+
version: 7.0.0.beta.3
|
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-
|
11
|
+
date: 2021-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -370,6 +370,7 @@ files:
|
|
370
370
|
- spec/dummy/lib/forest_liana/collections/user.rb
|
371
371
|
- spec/helpers/forest_liana/query_helper_spec.rb
|
372
372
|
- spec/helpers/forest_liana/schema_helper_spec.rb
|
373
|
+
- spec/lib/forest_liana/bootstrapper_spec.rb
|
373
374
|
- spec/lib/forest_liana/schema_file_updater_spec.rb
|
374
375
|
- spec/rails_helper.rb
|
375
376
|
- spec/requests/actions_controller_spec.rb
|
@@ -505,168 +506,169 @@ signing_key:
|
|
505
506
|
specification_version: 4
|
506
507
|
summary: Official Rails Liana for Forest
|
507
508
|
test_files:
|
509
|
+
- test/routing/route_test.rb
|
508
510
|
- test/forest_liana_test.rb
|
509
|
-
- test/
|
510
|
-
- test/services/forest_liana/has_many_getter_test.rb
|
511
|
-
- test/services/forest_liana/pie_stat_getter_test.rb
|
511
|
+
- test/services/forest_liana/schema_adapter_test.rb
|
512
512
|
- test/services/forest_liana/resource_updater_test.rb
|
513
|
-
- test/services/forest_liana/value_stat_getter_test.rb
|
514
513
|
- test/services/forest_liana/scope_validator_test.rb
|
515
|
-
- test/services/forest_liana/schema_adapter_test.rb
|
516
514
|
- test/services/forest_liana/operator_date_interval_parser_test.rb
|
517
|
-
- test/
|
515
|
+
- test/services/forest_liana/value_stat_getter_test.rb
|
516
|
+
- test/services/forest_liana/has_many_getter_test.rb
|
517
|
+
- test/services/forest_liana/pie_stat_getter_test.rb
|
518
518
|
- test/fixtures/string_field.yml
|
519
|
-
- test/fixtures/
|
519
|
+
- test/fixtures/reference.yml
|
520
520
|
- test/fixtures/has_one_field.yml
|
521
|
-
- test/fixtures/
|
521
|
+
- test/fixtures/tree.yml
|
522
|
+
- test/fixtures/serialize_field.yml
|
522
523
|
- test/fixtures/has_many_field.yml
|
523
|
-
- test/fixtures/reference.yml
|
524
524
|
- test/fixtures/owner.yml
|
525
525
|
- test/fixtures/belongs_to_field.yml
|
526
|
-
- test/fixtures/
|
526
|
+
- test/fixtures/has_many_through_field.yml
|
527
|
+
- test/dummy/README.rdoc
|
528
|
+
- test/dummy/config.ru
|
529
|
+
- test/dummy/Rakefile
|
527
530
|
- test/dummy/db/schema.rb
|
528
531
|
- test/dummy/db/migrate/20150608131610_create_float_field.rb
|
529
|
-
- test/dummy/db/migrate/
|
532
|
+
- test/dummy/db/migrate/20150623115554_create_has_many_class_name_field.rb
|
533
|
+
- test/dummy/db/migrate/20181111162121_create_references_table.rb
|
530
534
|
- test/dummy/db/migrate/20170614141921_create_serialize_field.rb
|
535
|
+
- test/dummy/db/migrate/20150608133044_create_has_one_field.rb
|
531
536
|
- test/dummy/db/migrate/20150609114636_create_belongs_to_class_name_field.rb
|
537
|
+
- test/dummy/db/migrate/20160627172951_create_tree.rb
|
532
538
|
- test/dummy/db/migrate/20150608130516_create_date_field.rb
|
539
|
+
- test/dummy/db/migrate/20150608131430_create_integer_field.rb
|
540
|
+
- test/dummy/db/migrate/20150608133038_create_belongs_to_field.rb
|
533
541
|
- test/dummy/db/migrate/20150612112520_create_has_and_belongs_to_many_field.rb
|
534
|
-
- test/dummy/db/migrate/20150608132621_create_string_field.rb
|
535
542
|
- test/dummy/db/migrate/20150608132159_create_boolean_field.rb
|
536
|
-
- test/dummy/db/migrate/20150608133038_create_belongs_to_field.rb
|
537
|
-
- test/dummy/db/migrate/20150623115554_create_has_many_class_name_field.rb
|
538
|
-
- test/dummy/db/migrate/20181111162121_create_references_table.rb
|
539
|
-
- test/dummy/db/migrate/20150814081918_create_has_many_through_field.rb
|
540
543
|
- test/dummy/db/migrate/20160627172810_create_owner.rb
|
541
|
-
- test/dummy/db/migrate/
|
544
|
+
- test/dummy/db/migrate/20150616150629_create_polymorphic_field.rb
|
545
|
+
- test/dummy/db/migrate/20150608132621_create_string_field.rb
|
546
|
+
- test/dummy/db/migrate/20160628173505_add_timestamps.rb
|
542
547
|
- test/dummy/db/migrate/20150608150016_create_has_many_field.rb
|
548
|
+
- test/dummy/db/migrate/20150814081918_create_has_many_through_field.rb
|
543
549
|
- test/dummy/db/migrate/20150608131603_create_decimal_field.rb
|
544
|
-
- test/dummy/
|
545
|
-
- test/dummy/
|
546
|
-
- test/dummy/
|
547
|
-
- test/dummy/config.
|
548
|
-
- test/dummy/
|
549
|
-
- test/dummy/
|
550
|
-
- test/dummy/bin/bundle
|
551
|
-
- test/dummy/bin/rails
|
552
|
-
- test/dummy/config/routes.rb
|
550
|
+
- test/dummy/config/environment.rb
|
551
|
+
- test/dummy/config/secrets.yml
|
552
|
+
- test/dummy/config/application.rb
|
553
|
+
- test/dummy/config/environments/test.rb
|
554
|
+
- test/dummy/config/environments/development.rb
|
555
|
+
- test/dummy/config/environments/production.rb
|
553
556
|
- test/dummy/config/boot.rb
|
554
|
-
- test/dummy/config/
|
557
|
+
- test/dummy/config/locales/en.yml
|
558
|
+
- test/dummy/config/database.yml
|
559
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
555
560
|
- test/dummy/config/initializers/assets.rb
|
561
|
+
- test/dummy/config/initializers/backtrace_silencers.rb
|
562
|
+
- test/dummy/config/initializers/mime_types.rb
|
556
563
|
- test/dummy/config/initializers/session_store.rb
|
557
564
|
- test/dummy/config/initializers/wrap_parameters.rb
|
558
565
|
- test/dummy/config/initializers/filter_parameter_logging.rb
|
559
|
-
- test/dummy/config/initializers/cookies_serializer.rb
|
560
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
561
566
|
- test/dummy/config/initializers/inflections.rb
|
562
|
-
- test/dummy/config/
|
563
|
-
- test/dummy/
|
564
|
-
- test/dummy/config/environment.rb
|
565
|
-
- test/dummy/config/environments/production.rb
|
566
|
-
- test/dummy/config/environments/development.rb
|
567
|
-
- test/dummy/config/environments/test.rb
|
568
|
-
- test/dummy/config/database.yml
|
569
|
-
- test/dummy/config/application.rb
|
570
|
-
- test/dummy/README.rdoc
|
571
|
-
- test/dummy/Rakefile
|
572
|
-
- test/dummy/public/favicon.ico
|
567
|
+
- test/dummy/config/routes.rb
|
568
|
+
- test/dummy/public/500.html
|
573
569
|
- test/dummy/public/404.html
|
574
570
|
- test/dummy/public/422.html
|
575
|
-
- test/dummy/public/
|
576
|
-
- test/dummy/app/controllers/application_controller.rb
|
577
|
-
- test/dummy/app/views/layouts/application.html.erb
|
578
|
-
- test/dummy/app/helpers/application_helper.rb
|
579
|
-
- test/dummy/app/assets/stylesheets/application.css
|
580
|
-
- test/dummy/app/assets/config/manifest.js
|
581
|
-
- test/dummy/app/assets/javascripts/application.js
|
571
|
+
- test/dummy/public/favicon.ico
|
582
572
|
- test/dummy/app/models/boolean_field.rb
|
583
|
-
- test/dummy/app/models/decimal_field.rb
|
584
|
-
- test/dummy/app/models/date_field.rb
|
585
|
-
- test/dummy/app/models/tree.rb
|
586
|
-
- test/dummy/app/models/has_and_belongs_to_many_field.rb
|
587
|
-
- test/dummy/app/models/owner.rb
|
588
|
-
- test/dummy/app/models/belongs_to_class_name_field.rb
|
589
|
-
- test/dummy/app/models/has_many_through_field.rb
|
590
573
|
- test/dummy/app/models/float_field.rb
|
591
|
-
- test/dummy/app/models/polymorphic_field.rb
|
592
|
-
- test/dummy/app/models/has_one_field.rb
|
593
|
-
- test/dummy/app/models/has_many_class_name_field.rb
|
594
|
-
- test/dummy/app/models/belongs_to_field.rb
|
595
574
|
- test/dummy/app/models/integer_field.rb
|
575
|
+
- test/dummy/app/models/reference.rb
|
576
|
+
- test/dummy/app/models/has_one_field.rb
|
577
|
+
- test/dummy/app/models/belongs_to_class_name_field.rb
|
578
|
+
- test/dummy/app/models/tree.rb
|
596
579
|
- test/dummy/app/models/serialize_field.rb
|
580
|
+
- test/dummy/app/models/polymorphic_field.rb
|
581
|
+
- test/dummy/app/models/date_field.rb
|
597
582
|
- test/dummy/app/models/string_field.rb
|
598
583
|
- test/dummy/app/models/has_many_field.rb
|
599
|
-
- test/dummy/app/models/
|
600
|
-
-
|
601
|
-
-
|
602
|
-
-
|
584
|
+
- test/dummy/app/models/has_and_belongs_to_many_field.rb
|
585
|
+
- test/dummy/app/models/has_many_class_name_field.rb
|
586
|
+
- test/dummy/app/models/decimal_field.rb
|
587
|
+
- test/dummy/app/models/owner.rb
|
588
|
+
- test/dummy/app/models/belongs_to_field.rb
|
589
|
+
- test/dummy/app/models/has_many_through_field.rb
|
590
|
+
- test/dummy/app/helpers/application_helper.rb
|
591
|
+
- test/dummy/app/views/layouts/application.html.erb
|
592
|
+
- test/dummy/app/assets/javascripts/application.js
|
593
|
+
- test/dummy/app/assets/stylesheets/application.css
|
594
|
+
- test/dummy/app/assets/config/manifest.js
|
595
|
+
- test/dummy/app/controllers/application_controller.rb
|
596
|
+
- test/dummy/bin/setup
|
597
|
+
- test/dummy/bin/bundle
|
598
|
+
- test/dummy/bin/rake
|
599
|
+
- test/dummy/bin/rails
|
600
|
+
- test/test_helper.rb
|
601
|
+
- spec/helpers/forest_liana/schema_helper_spec.rb
|
602
|
+
- spec/helpers/forest_liana/query_helper_spec.rb
|
603
|
+
- spec/services/forest_liana/permissions_checker_live_queries_spec.rb
|
603
604
|
- spec/services/forest_liana/ip_whitelist_checker_spec.rb
|
604
|
-
- spec/services/forest_liana/
|
605
|
-
- spec/services/forest_liana/filters_parser_spec.rb
|
605
|
+
- spec/services/forest_liana/line_stat_getter_spec.rb
|
606
606
|
- spec/services/forest_liana/schema_adapter_spec.rb
|
607
|
+
- spec/services/forest_liana/resources_getter_spec.rb
|
607
608
|
- spec/services/forest_liana/smart_action_field_validator_spec.rb
|
608
|
-
- spec/services/forest_liana/line_stat_getter_spec.rb
|
609
|
-
- spec/services/forest_liana/permissions_formatter_spec.rb
|
610
|
-
- spec/services/forest_liana/permissions_checker_live_queries_spec.rb
|
611
609
|
- spec/services/forest_liana/apimap_sorter_spec.rb
|
610
|
+
- spec/services/forest_liana/filters_parser_spec.rb
|
611
|
+
- spec/services/forest_liana/permissions_checker_acl_enabled_spec.rb
|
612
|
+
- spec/services/forest_liana/permissions_formatter_spec.rb
|
613
|
+
- spec/services/forest_liana/permissions_getter_spec.rb
|
612
614
|
- spec/services/forest_liana/permissions_checker_acl_disabled_spec.rb
|
615
|
+
- spec/spec_helper.rb
|
613
616
|
- spec/config/initializers/logger_spec.rb
|
614
|
-
- spec/
|
615
|
-
- spec/
|
617
|
+
- spec/lib/forest_liana/schema_file_updater_spec.rb
|
618
|
+
- spec/lib/forest_liana/bootstrapper_spec.rb
|
619
|
+
- spec/requests/stats_spec.rb
|
620
|
+
- spec/requests/actions_controller_spec.rb
|
621
|
+
- spec/requests/authentications_spec.rb
|
622
|
+
- spec/requests/resources_spec.rb
|
623
|
+
- spec/dummy/README.rdoc
|
624
|
+
- spec/dummy/config.ru
|
625
|
+
- spec/dummy/Rakefile
|
616
626
|
- spec/dummy/db/schema.rb
|
617
|
-
- spec/dummy/db/migrate/20190226172951_create_user.rb
|
618
|
-
- spec/dummy/db/migrate/20190716135241_add_type_to_user.rb
|
619
627
|
- spec/dummy/db/migrate/20190226173051_create_isle.rb
|
620
|
-
- spec/dummy/db/migrate/20210511141752_create_owners.rb
|
621
628
|
- spec/dummy/db/migrate/20190716130830_add_age_to_tree.rb
|
622
629
|
- spec/dummy/db/migrate/20210326140855_create_locations.rb
|
623
630
|
- spec/dummy/db/migrate/20190226174951_create_tree.rb
|
624
|
-
- spec/dummy/db/migrate/20210526084712_create_products.rb
|
625
631
|
- spec/dummy/db/migrate/20210326110524_create_references.rb
|
626
|
-
- spec/dummy/
|
627
|
-
- spec/dummy/
|
628
|
-
- spec/dummy/
|
629
|
-
- spec/dummy/
|
630
|
-
- spec/dummy/
|
631
|
-
- spec/dummy/config/
|
632
|
+
- spec/dummy/db/migrate/20210511141752_create_owners.rb
|
633
|
+
- spec/dummy/db/migrate/20190716135241_add_type_to_user.rb
|
634
|
+
- spec/dummy/db/migrate/20190226172951_create_user.rb
|
635
|
+
- spec/dummy/db/migrate/20210526084712_create_products.rb
|
636
|
+
- spec/dummy/config/environment.rb
|
637
|
+
- spec/dummy/config/secrets.yml
|
638
|
+
- spec/dummy/config/application.rb
|
639
|
+
- spec/dummy/config/environments/test.rb
|
640
|
+
- spec/dummy/config/environments/development.rb
|
641
|
+
- spec/dummy/config/environments/production.rb
|
632
642
|
- spec/dummy/config/boot.rb
|
633
|
-
- spec/dummy/config/
|
634
|
-
- spec/dummy/config/initializers/
|
643
|
+
- spec/dummy/config/database.yml
|
644
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
635
645
|
- spec/dummy/config/initializers/assets.rb
|
646
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
647
|
+
- spec/dummy/config/initializers/mime_types.rb
|
636
648
|
- spec/dummy/config/initializers/session_store.rb
|
637
649
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
638
650
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
639
|
-
- spec/dummy/config/initializers/cookies_serializer.rb
|
640
|
-
- spec/dummy/config/initializers/backtrace_silencers.rb
|
641
651
|
- spec/dummy/config/initializers/inflections.rb
|
642
|
-
- spec/dummy/config/
|
643
|
-
- spec/dummy/config/
|
644
|
-
- spec/dummy/config/environments/production.rb
|
645
|
-
- spec/dummy/config/environments/development.rb
|
646
|
-
- spec/dummy/config/environments/test.rb
|
647
|
-
- spec/dummy/config/database.yml
|
648
|
-
- spec/dummy/config/application.rb
|
649
|
-
- spec/dummy/lib/forest_liana/collections/user.rb
|
652
|
+
- spec/dummy/config/initializers/forest_liana.rb
|
653
|
+
- spec/dummy/config/routes.rb
|
650
654
|
- spec/dummy/lib/forest_liana/collections/location.rb
|
651
|
-
- spec/dummy/
|
652
|
-
- spec/dummy/Rakefile
|
653
|
-
- spec/dummy/app/controllers/application_controller.rb
|
654
|
-
- spec/dummy/app/views/layouts/application.html.erb
|
655
|
-
- spec/dummy/app/config/routes.rb
|
656
|
-
- spec/dummy/app/helpers/application_helper.rb
|
657
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
658
|
-
- spec/dummy/app/assets/config/manifest.js
|
659
|
-
- spec/dummy/app/assets/javascripts/application.js
|
660
|
-
- spec/dummy/app/models/tree.rb
|
661
|
-
- spec/dummy/app/models/owner.rb
|
662
|
-
- spec/dummy/app/models/user.rb
|
663
|
-
- spec/dummy/app/models/product.rb
|
655
|
+
- spec/dummy/lib/forest_liana/collections/user.rb
|
664
656
|
- spec/dummy/app/models/location.rb
|
665
657
|
- spec/dummy/app/models/island.rb
|
666
658
|
- spec/dummy/app/models/reference.rb
|
667
|
-
- spec/
|
659
|
+
- spec/dummy/app/models/tree.rb
|
660
|
+
- spec/dummy/app/models/user.rb
|
661
|
+
- spec/dummy/app/models/product.rb
|
662
|
+
- spec/dummy/app/models/owner.rb
|
663
|
+
- spec/dummy/app/helpers/application_helper.rb
|
664
|
+
- spec/dummy/app/config/routes.rb
|
665
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
666
|
+
- spec/dummy/app/assets/javascripts/application.js
|
667
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
668
|
+
- spec/dummy/app/assets/config/manifest.js
|
669
|
+
- spec/dummy/app/controllers/application_controller.rb
|
670
|
+
- spec/dummy/bin/setup
|
671
|
+
- spec/dummy/bin/bundle
|
672
|
+
- spec/dummy/bin/rake
|
673
|
+
- spec/dummy/bin/rails
|
668
674
|
- spec/rails_helper.rb
|
669
|
-
- spec/requests/stats_spec.rb
|
670
|
-
- spec/requests/resources_spec.rb
|
671
|
-
- spec/requests/actions_controller_spec.rb
|
672
|
-
- spec/requests/authentications_spec.rb
|