forest_liana 8.0.0.beta.1 → 8.0.0.beta.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82036a005a4c2e31b6e1e48c7f9d5befacb5b72ba71046bd5bcfa83d43c19797
|
4
|
+
data.tar.gz: c825c64871dd4737961a589c3869c07126ddf8023265822cb73a2019aa82ed2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c519f23a7c267b77cd83a42859e9aac9996955d2ec918c1d562c5d3ceda2c15638840fae765b2241b12a2f5dba38be8de898923879cd2b8c82902a77c583192c
|
7
|
+
data.tar.gz: f3e06eabdee80eab3b8991c355a1af15e1601d2e8ba35adb7160f9d367958f7473f236cbb011f0907be5073cc111efc17138b67c88c727827def72ab8261d0c1
|
@@ -37,6 +37,8 @@ module ForestLiana
|
|
37
37
|
elsif @smart_action['approvalRequired'].include?(@user['roleId'])
|
38
38
|
if @smart_action['approvalRequiredConditions'].empty? || match_conditions('approvalRequiredConditions')
|
39
39
|
raise ForestLiana::Ability::Exceptions::RequireApproval.new(@smart_action['userApprovalEnabled'])
|
40
|
+
else
|
41
|
+
return true if @smart_action['triggerConditions'].empty? || match_conditions('triggerConditions')
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
@@ -202,7 +202,7 @@ module ForestLiana
|
|
202
202
|
def setup_forest_liana_meta
|
203
203
|
ForestLiana.meta = {
|
204
204
|
liana: 'forest-rails',
|
205
|
-
liana_version: ForestLiana::VERSION,
|
205
|
+
liana_version: ForestLiana::VERSION.sub!('.beta', '-beta'),
|
206
206
|
stack: {
|
207
207
|
database_type: database_type,
|
208
208
|
orm_version: Gem.loaded_specs["activerecord"].version.version,
|
data/lib/forest_liana/version.rb
CHANGED
@@ -205,9 +205,67 @@ module ForestLiana
|
|
205
205
|
expect{smart_action_checker.can_execute?}.to raise_error(ForestLiana::Ability::Exceptions::TriggerForbidden)
|
206
206
|
end
|
207
207
|
|
208
|
-
it 'should
|
208
|
+
it 'should trigger action when approvalRequiredCondition not match but with triggerConditions matched' do
|
209
|
+
parameters = ActionController::Parameters.new(params).permit!
|
210
|
+
action['approvalRequired'] = [1]
|
211
|
+
action['triggerEnabled'] = [1]
|
212
|
+
action['triggerConditions'] = [
|
213
|
+
{ 'filter' =>
|
214
|
+
{ 'aggregator' => 'and',
|
215
|
+
'conditions' =>
|
216
|
+
[
|
217
|
+
{
|
218
|
+
'field' => 'name',
|
219
|
+
'value' => 'foo',
|
220
|
+
'source' => 'data',
|
221
|
+
'operator' => 'equal'
|
222
|
+
}
|
223
|
+
]
|
224
|
+
},
|
225
|
+
'roleId' => 1
|
226
|
+
}
|
227
|
+
]
|
228
|
+
action['approvalRequiredConditions'] = [
|
229
|
+
{ 'filter' =>
|
230
|
+
{ 'aggregator' => 'and',
|
231
|
+
'conditions' =>
|
232
|
+
[
|
233
|
+
{
|
234
|
+
'field' => 'name',
|
235
|
+
'value' => 'fake island',
|
236
|
+
'source' => 'data',
|
237
|
+
'operator' => 'equal'
|
238
|
+
}
|
239
|
+
]
|
240
|
+
},
|
241
|
+
'roleId' => 1
|
242
|
+
}
|
243
|
+
]
|
244
|
+
smart_action_checker = ForestLiana::Ability::Permission::SmartActionChecker.new(parameters, Island, action, user)
|
245
|
+
|
246
|
+
expect(smart_action_checker.can_execute?).to equal true
|
247
|
+
end
|
248
|
+
|
249
|
+
it 'should raise error when approvalRequiredConditions and triggerConditions not match' do
|
209
250
|
parameters = ActionController::Parameters.new(params).permit!
|
210
251
|
action['approvalRequired'] = [1]
|
252
|
+
action['triggerEnabled'] = [1]
|
253
|
+
action['triggerConditions'] = [
|
254
|
+
{ 'filter' =>
|
255
|
+
{ 'aggregator' => 'and',
|
256
|
+
'conditions' =>
|
257
|
+
[
|
258
|
+
{
|
259
|
+
'field' => 'name',
|
260
|
+
'value' => 'fake island',
|
261
|
+
'source' => 'data',
|
262
|
+
'operator' => 'equal'
|
263
|
+
}
|
264
|
+
]
|
265
|
+
},
|
266
|
+
'roleId' => 1
|
267
|
+
}
|
268
|
+
]
|
211
269
|
action['approvalRequiredConditions'] = [
|
212
270
|
{ 'filter' =>
|
213
271
|
{ 'aggregator' => 'and',
|
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.0.beta.
|
4
|
+
version: 8.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: 2023-02-
|
11
|
+
date: 2023-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|