Module: Handcart::ControllerAdditions::ClassMethods
- Defined in:
- lib/handcart/controller_additions.rb
Instance Method Summary collapse
-
#enable_blocking(rejection, *args) ⇒ Object
Enable IP Blocking on the sessions controller.
- #enable_forwarding(forwarding, rejection, *args) ⇒ Object
Instance Method Details
#enable_blocking(rejection, *args) ⇒ Object
Enable IP Blocking on the sessions controller
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/handcart/controller_additions.rb', line 21 def enable_blocking(rejection, *args) = args. self.class_variable_set(:@@rejection_url, rejection) if Handcart.global_ip_blocking_enabled_environments.include?(Rails.env) before_action :setup_blocking_resources, .slice(:except, :only) before_action :allow_or_reject, .slice(:except, :only) else # Do nothing, no blocking is enabled end end |
#enable_forwarding(forwarding, rejection, *args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/handcart/controller_additions.rb', line 7 def enable_forwarding(forwarding, rejection, *args) self.class_variable_set(:@@forwarding_url, forwarding) self.class_variable_set(:@@rejection_url, rejection) = args. if Handcart.global_ip_forwarding_enabled_environments.include?(Rails.env) before_action :setup_forwarding_resources, .slice(:except, :only) before_action :forward_or_reject, .slice(:except, :only) else # No forwarding is enabled end end |