Sha256: 8cd3f31b243082ee202f57346023352bcd88df1aa8c38ab7c38b4fc9c5d81445

Contents?: true

Size: 723 Bytes

Versions: 13

Compression:

Stored size: 723 Bytes

Contents

module RailsDb
  class ApplicationController < ActionController::Base
    helper :all
    helper_method :per_page

    if Rails::VERSION::MAJOR >= 4
      before_action :verify_access
    else
      before_filter :verify_access
    end

    if RailsDb.http_basic_authentication_enabled
      http_basic_authenticate_with name: RailsDb.http_basic_authentication_user_name,
                                   password: RailsDb.http_basic_authentication_password
    end

    private

    def verify_access
      result = RailsDb.verify_access_proc.call(self)
      redirect_to('/', error: 'Access Denied', status: 401) unless result
    end

    def per_page
      params[:per_page] || session[:per_page]
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rails_db-1.6.0 app/controllers/rails_db/application_controller.rb
rails_db-1.5.0 app/controllers/rails_db/application_controller.rb
rails_db-1.4.1 app/controllers/rails_db/application_controller.rb
rails_db-1.4.0 app/controllers/rails_db/application_controller.rb
rails_db-1.3.4 app/controllers/rails_db/application_controller.rb
rails_db-1.3.3 app/controllers/rails_db/application_controller.rb
rails_db-1.3.2 app/controllers/rails_db/application_controller.rb
rails_db-1.3.1 app/controllers/rails_db/application_controller.rb
rails_db-1.3 app/controllers/rails_db/application_controller.rb
rails_db-1.1.1 app/controllers/rails_db/application_controller.rb
rails_db-1.1 app/controllers/rails_db/application_controller.rb
rails_db-1.0 app/controllers/rails_db/application_controller.rb
rails_db-0.9.9 app/controllers/rails_db/application_controller.rb