class Restrict::Gatekeeper
Public Instance Methods
eye(controller)
click to toggle source
# File lib/restrict/gatekeeper.rb, line 3 def eye(controller) Array(concerning_restrictions(controller)).each do |restriction| handle_restriction(restriction, controller) end end
Private Instance Methods
concerning_restrictions(controller)
click to toggle source
# File lib/restrict/gatekeeper.rb, line 21 def concerning_restrictions(controller) controller.restrictions or return controller.restrictions.select do |restriction| restriction.applies_to?(controller.action_name) end end
handle_restriction(restriction, controller)
click to toggle source
# File lib/restrict/gatekeeper.rb, line 16 def handle_restriction(restriction, controller) validate_signed_in(controller) restriction.validate(controller) end
validate_signed_in(controller)
click to toggle source
# File lib/restrict/gatekeeper.rb, line 11 def validate_signed_in(controller) method = Restrict.config.authentication_validation_method controller.__send__(method) or raise Restrict::LoginRequired end