knowledge_bases_controller_policy.rb 494 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. class Controllers::KnowledgeBasesControllerPolicy < Controllers::KnowledgeBase::BaseControllerPolicy
  3. def init?
  4. true
  5. end
  6. def create?
  7. false
  8. end
  9. def destroy?
  10. false
  11. end
  12. def update?
  13. access(__method__)
  14. end
  15. private
  16. def object
  17. @object ||= record.klass.find(record.params[:id])
  18. end
  19. def access(method)
  20. KnowledgeBase::CategoryPolicy.new(user, object).send(method)
  21. end
  22. end