ticket_checklist_controller_policy.rb 711 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Controllers::TicketChecklistControllerPolicy < Controllers::ApplicationControllerPolicy
  3. def show?
  4. read_access_via_ticket?
  5. end
  6. def create?
  7. update_access_via_ticket?
  8. end
  9. def destroy?
  10. update_access_via_ticket?
  11. end
  12. def update?
  13. update_access_via_ticket?
  14. end
  15. def completed?
  16. update_access_via_ticket?
  17. end
  18. private
  19. def ticket_policy
  20. @ticket_policy ||= TicketPolicy.new(user, Ticket.lookup(id: record.params[:ticket_id]))
  21. end
  22. def read_access_via_ticket?
  23. ticket_policy.agent_read_access?
  24. end
  25. def update_access_via_ticket?
  26. ticket_policy.agent_update_access?
  27. end
  28. end