scope.rb 375 B

12345678910111213141516171819
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class KnowledgeBase::AnswerPolicy < ApplicationPolicy
  3. class Scope < ApplicationPolicy::Scope
  4. def resolve
  5. if user&.permissions?('knowledge_base.editor')
  6. scope
  7. else
  8. scope.published
  9. end
  10. end
  11. private
  12. def user_required?
  13. false
  14. end
  15. end
  16. end