Sha256: 4cc5e3701d91aa4b77785d5bd198469e036000dff2810c729a3844463874a81a

Contents?: true

Size: 679 Bytes

Versions: 3

Compression:

Stored size: 679 Bytes

Contents

class BaseController < ActionController::Base
  layout 'rails_performance/layouts/rails_performance'

  before_action :leave_finger_print
  before_action :verify_access

  if RailsPerformance.http_basic_authentication_enabled
    http_basic_authenticate_with \
      name: RailsPerformance.http_basic_authentication_user_name,
      password: RailsPerformance.http_basic_authentication_password
  end

  private

  def leave_finger_print
    Thread.current[:in_rails_performance] = true
  end

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

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_performance-0.0.1.18 app/controllers/base_controller.rb
rails_performance-0.0.1.17 app/controllers/base_controller.rb
rails_performance-0.0.1.16 app/controllers/base_controller.rb