scope.rb 407 B

12345678910111213141516
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class OrganizationPolicy < ApplicationPolicy
  3. class Scope < ApplicationPolicy::Scope
  4. def resolve
  5. if user.permissions?(['ticket.agent', 'admin.organization'])
  6. scope.all
  7. elsif user.organization_id
  8. scope.where(id: user.all_organization_ids)
  9. else
  10. scope.none
  11. end
  12. end
  13. end
  14. end