form_controller_policy.rb 493 B

123456789101112131415161718192021222324252627282930
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Controllers::FormControllerPolicy < Controllers::ApplicationControllerPolicy
  3. def configuration?
  4. authorized?
  5. end
  6. def submit?
  7. authorized?
  8. end
  9. def test?
  10. record.params[:test] && user&.permissions?('admin.channel_formular')
  11. end
  12. private
  13. def authorized?
  14. test? || enabled?
  15. end
  16. def user_required?
  17. false
  18. end
  19. def enabled?
  20. Setting.get('form_ticket_create')
  21. end
  22. end