forest_liana 9.5.1 → 9.5.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: 8f0176683d5de6bb4bf2983218178607f846b76fc4974cbeb3c505b53cc74384
4
- data.tar.gz: 4f949dee10c6ffb77a394e0f4a5e82d9a0702d3ac388cf972b13746a062186c9
3
+ metadata.gz: 331a5a4b04f74fad06fa9b8f9443e2a91c27685483fb1bba39bedb1b409c498c
4
+ data.tar.gz: 055da277ebd38b2617dbc5b61a24dfb0b0bf474bb65fb8763d50ed694926122a
5
5
  SHA512:
6
- metadata.gz: 6a7e3a0a475c400559c0acfb14c2f0b2d08ebc84b38356486ccc2d851a822b1f4e3c9864ef31d1c0d6a870ba9774b3e9c990610f19e081a474231749a68000e1
7
- data.tar.gz: baf28439443b7de0509b45b6d8e8c57323cd4dce5b6b38ea6c1666329505423c9222dc2bd2ccc7e7505701663e51d983d7aa7c711169564093aa6181952a7898
6
+ metadata.gz: 50c346b60aea696ed3295aa82c51cb92167e94c0a24168f039f1d673f2c9e48bed79b6699004d00b55e35bfb3b1ed55a0465c8f8b824256e645da831ca6b89cd
7
+ data.tar.gz: aa3fd7c4133120ff50c0c88a4ab0b5873a6f5a28d1acd83b11a409a3557e15c0f8dbad572a43f44f39e1ba0d142f282a4a9a9ebf68e8496d7cd1425eedd0b5ed
@@ -22,7 +22,7 @@ module ForestLiana
22
22
 
23
23
  def can_approve?
24
24
  @parameters = RequestPermission.decodeSignedApprovalRequest(@parameters)
25
- if ((@smart_action['userApprovalConditions'].empty? || match_conditions('userApprovalConditions')) &&
25
+ if ((condition_by_role_id(@smart_action['userApprovalConditions']).blank? || match_conditions('userApprovalConditions')) &&
26
26
  (@parameters[:data][:attributes][:requester_id] != @user['id'] || @smart_action['selfApprovalEnabled'].include?(@user['roleId']))
27
27
  )
28
28
  return true
@@ -33,12 +33,12 @@ module ForestLiana
33
33
 
34
34
  def can_trigger?
35
35
  if @smart_action['triggerEnabled'].include?(@user['roleId']) && @smart_action['approvalRequired'].exclude?(@user['roleId'])
36
- return true if @smart_action['triggerConditions'].empty? || match_conditions('triggerConditions')
36
+ return true if condition_by_role_id(@smart_action['triggerConditions']).blank? || match_conditions('triggerConditions')
37
37
  elsif @smart_action['approvalRequired'].include?(@user['roleId'])
38
- if @smart_action['approvalRequiredConditions'].empty? || match_conditions('approvalRequiredConditions')
38
+ if condition_by_role_id(@smart_action['approvalRequiredConditions']).blank? || match_conditions('approvalRequiredConditions')
39
39
  raise ForestLiana::Ability::Exceptions::RequireApproval.new(@smart_action['userApprovalEnabled'])
40
40
  else
41
- return true if @smart_action['triggerConditions'].empty? || match_conditions('triggerConditions')
41
+ return true if condition_by_role_id(@smart_action['triggerConditions']).blank? || match_conditions('triggerConditions')
42
42
  end
43
43
  end
44
44
 
@@ -48,8 +48,10 @@ module ForestLiana
48
48
  def match_conditions(condition_name)
49
49
  begin
50
50
  attributes = @parameters[:data][:attributes]
51
+ condition = condition_by_role_id(@smart_action[condition_name])
52
+
51
53
  records = FiltersParser.new(
52
- @smart_action[condition_name][0]['filter'],
54
+ condition['filter'],
53
55
  @collection,
54
56
  @parameters[:timezone],
55
57
  @parameters
@@ -67,6 +69,10 @@ module ForestLiana
67
69
  raise ForestLiana::Ability::Exceptions::ActionConditionError.new
68
70
  end
69
71
  end
72
+
73
+ def condition_by_role_id(condition)
74
+ condition.find { |c| c['roleId'] == @user['roleId'] }
75
+ end
70
76
  end
71
77
  end
72
78
  end
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "9.5.1"
2
+ VERSION = "9.5.3"
3
3
  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: 9.5.1
4
+ version: 9.5.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: 2024-11-13 00:00:00.000000000 Z
11
+ date: 2024-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails