forest_liana 9.5.1 → 9.5.2

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: 93e5e9bbc17d64a32b2d38ce4effa876d682c356dbf1d180eb5e0117db644604
4
+ data.tar.gz: 52b8528c2d513cd0b906d8d69f7a163053976cdfc09fdb8484f83702354c2b23
5
5
  SHA512:
6
- metadata.gz: 6a7e3a0a475c400559c0acfb14c2f0b2d08ebc84b38356486ccc2d851a822b1f4e3c9864ef31d1c0d6a870ba9774b3e9c990610f19e081a474231749a68000e1
7
- data.tar.gz: baf28439443b7de0509b45b6d8e8c57323cd4dce5b6b38ea6c1666329505423c9222dc2bd2ccc7e7505701663e51d983d7aa7c711169564093aa6181952a7898
6
+ metadata.gz: 40fd658783f4362c1ec6fd94224a160d31ee29277f87eee3bfc53223d91f4e7854be9ba6c0eecd645c39723c5e4338962fc70b785c53e0e527a9e687b8fc3660
7
+ data.tar.gz: 2620e9af72ecf6c7cd596ac4d596c36b10477b3ee0091cacb1758c233e890b85719c5acdfe678fffdc2e41e6c07c501585ddb6f81cd65b597a8864cd58187d06
@@ -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.2"
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.2
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-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails