Module: Assistant::EmployeeToolAuthorization
- Defined in:
- app/services/assistant/employee_tool_authorization.rb
Overview
Central authorization boundary for Sunny tools that operate as an employee.
Tool builders still choose the exact action and resource they expose; this
helper keeps the active-account and CRM ability checks consistent.
Class Method Summary collapse
-
.allowed?(account, action, resource) ⇒ Boolean
Checks whether an active employee account may perform an action.
Class Method Details
.allowed?(account, action, resource) ⇒ Boolean
Checks whether an active employee account may perform an action.
17 18 19 20 21 22 |
# File 'app/services/assistant/employee_tool_authorization.rb', line 17 def allowed?(account, action, resource) account.present? && !account.disabled? && account.is_employee? && CrmAbility.new(account.party).can?(action, resource) end |