Sha256: d53639365bf3ad60e483a2768450ddcd04cccea9be181473801b3c8e72d1ef87

Contents?: true

Size: 685 Bytes

Versions: 7

Compression:

Stored size: 685 Bytes

Contents

module ResqueWeb
  class ApplicationController < ActionController::Base
    protect_from_forgery
    before_action :set_subtabs, :authorize

    helper :all

    def self.subtabs(*tab_names)
      return defined?(@subtabs) ? @subtabs : [] if tab_names.empty?
      @subtabs = tab_names
    end

    def set_subtabs(subtabs = self.class.subtabs)
      @subtabs = subtabs
    end

    private

    def authorize
      if ENV["RESQUE_WEB_HTTP_BASIC_AUTH_USER"] && ENV["RESQUE_WEB_HTTP_BASIC_AUTH_PASSWORD"]
        authenticate_or_request_with_http_basic {|u, p| u == ENV["RESQUE_WEB_HTTP_BASIC_AUTH_USER"] && p == ENV["RESQUE_WEB_HTTP_BASIC_AUTH_PASSWORD"] }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
resque-web-0.0.12 app/controllers/resque_web/application_controller.rb
resque-web-0.0.11 app/controllers/resque_web/application_controller.rb
resque-web-0.0.10 app/controllers/resque_web/application_controller.rb
misha-resque-web-0.1.1 app/controllers/resque_web/application_controller.rb
misha-resque-web-0.1.0 app/controllers/resque_web/application_controller.rb
misha-resque-web-0.0.9 app/controllers/resque_web/application_controller.rb
resque-web-0.0.9 app/controllers/resque_web/application_controller.rb