Module: OpenStax::Utilities::Access

Defined in:
lib/openstax/utilities/access.rb

Class Method Summary collapse

Class Method Details

.protect_beta(options = {}) ⇒ Object

Called in a controller to provide an outer level of basic HTTP authentication, typically used when code is deployed during development and it is not yet ready for public consumption.

Examples:

Basic usage

class ApplicationController < ActionController::Base
  protect_beta :username => 'bob',
               :password => '123'

Parameters:

  • :username

    The authentication username; default value is a random hex string

  • :password

    The authentication password; default value is a random hex string

  • :enable_always

    The default is the authentication is only enabled in production, setting this to true will make it effective in all environments

  • :message

    If given, this message will be displayed in the browser’s authentication dialog box.



47
48
49
# File 'lib/openstax/utilities/access.rb', line 47

def self.protect_beta(options={})
  # Just here for documentation purposes, see code above
end

.skip_protect_beta(options = {}) ⇒ Object

Called in a controller to skip the beta protection enabled elsewhere (e.g. in a parent controller). Takes options like skip_before_filter

Examples:

Usage to skip beta protection on index action

class MyController < ApplicationController
  skip_protect_beta :except => [:index]

Parameters:

  • :except

    Methods to not use this skip for

  • :only

    The only methods to use this skipping



61
62
63
# File 'lib/openstax/utilities/access.rb', line 61

def self.skip_protect_beta(options={})
  # Just here for documentation purposes, see code above
end