external_data_source_policy.rb 514 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class ExternalDataSourcePolicy < ApplicationPolicy
  3. def fetch?
  4. send :"fetch_#{record.downcase}?"
  5. end
  6. private
  7. def fetch_group?
  8. user.permissions?('admin.group')
  9. end
  10. def fetch_organization?
  11. user.permissions?(%w[admin.organization ticket.agent])
  12. end
  13. def fetch_user?
  14. user.permissions?(%w[admin.user ticket.agent])
  15. end
  16. def fetch_ticket?
  17. user.permissions?(%w[ticket.agent ticket.customer])
  18. end
  19. end