rules_controller.rb 500 B

1234567891011121314151617181920212223
  1. # frozen_string_literal: true
  2. class Api::V1::Instances::RulesController < Api::V1::Instances::BaseController
  3. skip_around_action :set_locale
  4. before_action :set_rules
  5. # Override `current_user` to avoid reading session cookies unless in whitelist mode
  6. def current_user
  7. super if limited_federation_mode?
  8. end
  9. def index
  10. cache_even_if_authenticated!
  11. render json: @rules, each_serializer: REST::RuleSerializer
  12. end
  13. private
  14. def set_rules
  15. @rules = Rule.ordered
  16. end
  17. end