knowledge_base_policy.rb 441 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class KnowledgeBasePolicy < ApplicationPolicy
  3. def show?
  4. access_editor? || access_reader?
  5. end
  6. def update?
  7. access_editor?
  8. end
  9. private
  10. def access
  11. @access ||= KnowledgeBase::EffectivePermission.new(user, record).access_effective
  12. end
  13. def access_editor?
  14. access == 'editor'
  15. end
  16. def access_reader?
  17. access == 'reader'
  18. end
  19. end