Class: ForestLiana::Ability::Permission::SmartActionChecker

Inherits:
Object
  • Object
show all
Defined in:
app/services/forest_liana/ability/permission/smart_action_checker.rb

Instance Method Summary collapse

Constructor Details

#initialize(parameters, collection, smart_action, user) ⇒ SmartActionChecker

Returns a new instance of SmartActionChecker.



6
7
8
9
10
11
# File 'app/services/forest_liana/ability/permission/smart_action_checker.rb', line 6

def initialize(parameters, collection, smart_action, user)
  @parameters = parameters
  @collection = collection
  @smart_action = smart_action
  @user = user
end

Instance Method Details

#can_execute?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
# File 'app/services/forest_liana/ability/permission/smart_action_checker.rb', line 13

def can_execute?
  if @parameters[:data][:attributes][:signed_approval_request].present? && @smart_action['userApprovalEnabled'].include?(@user['roleId'])
    can_approve?
  else
    can_trigger?
  end
end