form_controller_policy.rb 416 B

12345678910111213141516171819202122232425262728
  1. class Controllers::FormControllerPolicy < Controllers::ApplicationControllerPolicy
  2. def configuration?
  3. authorized?
  4. end
  5. def submit?
  6. authorized?
  7. end
  8. def test?
  9. record.params[:test] && user&.permissions?('admin.channel_formular')
  10. end
  11. private
  12. def authorized?
  13. test? || enabled?
  14. end
  15. def user_required?
  16. false
  17. end
  18. def enabled?
  19. Setting.get('form_ticket_create')
  20. end
  21. end