time_accounting_policy.rb 473 B

12345678910111213141516171819
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Ticket::TimeAccountingPolicy < ApplicationPolicy
  3. def create?
  4. if !Setting.get 'time_accounting'
  5. return not_authorized __('Time Accounting is not enabled')
  6. end
  7. agent_create_or_update_access?
  8. end
  9. private
  10. def agent_create_or_update_access?
  11. policy = TicketPolicy.new(user, record.ticket)
  12. policy.agent_update_access? || policy.agent_create_access?
  13. end
  14. end