Sha256: c6410c88923b990f23f6e901d15803fe9543fe748a7a84922d2e5d707c197f48

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

ActionController::Base.class_eval do

  def self.hobo_user_controller
    include Hobo::Controller::Model
    include Hobo::Controller::User
  end

  def self.hobo_model_controller
    include Hobo::Controller::Model
  end

  def self.hobo_controller
    include Hobo::Controller
  end

  def home_page
    base_url
  end

  # moved here from authentication_support.rb for easy overriding
  # Redirect as appropriate when an access request fails.
  #
  # The default action is to redirect to the login screen.
  #
  # Override this method in your controllers if you want to have special
  # behavior in case the user is not authorized
  # to access the requested action.  For example, a popup window might
  # simply close itself.
  def access_denied(user_model)
    respond_to do |accepts|
      accepts.html do
        store_location
        redirect_to(login_url(user_model))
      end
      accepts.xml do
        headers["Status"]           = "Unauthorized"
        headers["WWW-Authenticate"] = %(Basic realm="Web Password")
        render :text => t("hobo.messages.unauthenticated", :default=>["Couldn't authenticate you"]), :status => '401 Unauthorized'
      end
    end
    false
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hobo-1.3.0.RC2 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-1.3.0.RC1 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-1.3.0.RC lib/hobo/extensions/action_controller/hobo_methods.rb