checklist_policy.rb 532 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class ChecklistPolicy < ApplicationPolicy
  3. def show?
  4. check_prerequisites? && ticket_policy.agent_read_access?
  5. end
  6. def update?
  7. check_prerequisites? && ticket_policy.agent_update_access?
  8. end
  9. def destroy?
  10. check_prerequisites? && ticket_policy.agent_update_access?
  11. end
  12. private
  13. def check_prerequisites?
  14. Setting.get('checklist') && record&.ticket
  15. end
  16. def ticket_policy
  17. TicketPolicy.new(user, record.ticket)
  18. end
  19. end