Sha256: eab5ed40319ef348a8c28cef4d86ae8e776a619e5cc5e2262c2a50a72ff8d5f2
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
module RackAttackAdmin class ApplicationController < ::ApplicationController skip_authorization_check if respond_to? :skip_authorization_check before_action :require_admin, except: [:current_request] if method_defined?(:require_admin) before_action :toggle_flags #═════════════════════════════════════════════════════════════════════════════════════════════════ # Helpers def toggle_flags cookies[:skip_safelist] = params[:skip_safelist] if params[:skip_safelist] end helper_method \ def is_redis? Rack::Attack.cache.respond.store.respond_to? :ttl end helper_method \ def current_request_rack_attack_stats req = Rack::Attack::Request.new(request.env) { blocklisted?: Rack::Attack.blocklisted?(req), throttled?: Rack::Attack.throttled?(req), safelisted?: Rack::Attack.safelisted?(req), is_tracked?: Rack::Attack.is_tracked?(req), skip_safelist?: req.skip_safelist?, } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack_attack_admin-0.1.1 | app/controllers/rack_attack_admin/application_controller.rb |
rack_attack_admin-0.1.0 | app/controllers/rack_attack_admin/application_controller.rb |