content_policy.rb 431 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class KnowledgeBase::Answer::Translation::ContentPolicy < ApplicationPolicy
  3. delegate :show?, to: :parent_answer_policy
  4. delegate :destroy?, to: :parent_answer_policy
  5. def user_required?
  6. false
  7. end
  8. private
  9. def parent_answer_policy
  10. Pundit.policy user, parent_answer
  11. end
  12. def parent_answer
  13. record.translation.answer
  14. end
  15. end