shared_draft_start_policy.rb 539 B

12345678910111213141516171819202122232425262728
  1. # Copyright (C) 2012-2024 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 true if user.group_access? record.group_id, :create
  18. not_authorized Exceptions::UnprocessableEntity
  19. .new __('This user does not have access to the given group')
  20. end
  21. end