module Exits::ActionController::Helpers

Public Instance Methods

restrict_routes!() click to toggle source
# File lib/exits/action_controller/helpers.rb, line 26
def restrict_routes!
  unless self.class.rules.authorized?(self.class, current_user.class, action_name)
    restricted!
  end
end

Protected Instance Methods

allow!(kls) { || ... } click to toggle source
# File lib/exits/action_controller/helpers.rb, line 39
def allow!(kls, &block)
  return unless current_user.instance_of?(kls)
  unless yield
    restricted!
  end
end
restricted!() click to toggle source
# File lib/exits/action_controller/helpers.rb, line 46
def restricted!
  raise Exits::Rules::Unauthorized
end
unauthorized(exception) click to toggle source
# File lib/exits/action_controller/helpers.rb, line 34
def unauthorized(exception)
  flash.alert = t("exits.unauthorized")
  redirect_to :root
end