shared_draft_start_policy.rb 461 B

123456789101112131415161718192021222324252627
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class Ticket::SharedDraftStartPolicy < ApplicationPolicy
  3. def create?
  4. access?(__method__)
  5. end
  6. def update?
  7. access?(__method__)
  8. end
  9. def show?
  10. access?(__method__)
  11. end
  12. def destroy?
  13. access?(__method__)
  14. end
  15. private
  16. def access?(_method)
  17. return if !user.permissions?('ticket.agent')
  18. user.groups.access(:create).include? record.group
  19. end
  20. end