Sha256: 9a5e1d54c610858f14c690689d9ad6103fed124f57b73a0aee66ed5f8c30804c

Contents?: true

Size: 624 Bytes

Versions: 5

Compression:

Stored size: 624 Bytes

Contents

module RailsDb
  class ApplicationController < ActionController::Base

    helper :all

    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

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_db-0.8 app/controllers/rails_db/application_controller.rb
rails_db-0.7.2 app/controllers/rails_db/application_controller.rb
rails_db-0.7.1 app/controllers/rails_db/application_controller.rb
rails_db-0.7 app/controllers/rails_db/application_controller.rb
rails_db-0.6 app/controllers/rails_db/application_controller.rb