Sha256: f82d800359c3dc1737df86ca1022105a66bfcda055bb9a1d94703098e9b6139a

Contents?: true

Size: 1.18 KB

Versions: 39

Compression:

Stored size: 1.18 KB

Contents

ActionController::Base.class_eval do

  def self.hobo_user_controller
    include Hobo::Controller::Model
    include Hobo::Controller::UserBase
  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

39 entries across 39 versions & 1 rubygems

Version Path
hobo-2.2.6 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.2.5 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.2.4 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.2.3 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.2.2 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.2.1 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.2.0 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.1.2 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.1.1 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.1.0 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.1.0.pre4 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.1.0.pre3 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.1.0.pre2 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.1.0.pre1 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.0.1 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.0.0 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.0.0.pre10 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.0.0.pre9 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-2.0.0.pre8 lib/hobo/extensions/action_controller/hobo_methods.rb
hobo-1.3.3 lib/hobo/extensions/action_controller/hobo_methods.rb