class Hooks::OneuserAutocreateHook

Constants

ALLOWED_AUTH_STRATEGIES

Public Class Methods

new(app, options) click to toggle source

Instantiates the hook with some pre-processing done on provided options.

@param app [Object] application object @param options [Hashie::Mash] options in a hash-like structure

# File lib/hooks/oneuser_autocreate_hook.rb, line 11
def initialize(app, options)
  @app = app
  @options = options
  @vo_names = @options.vo_names.kind_of?(Array) ? @options.vo_names : @options.vo_names.split(' ')

  Rails.logger.debug "[Hooks] [OneuserAutocreateHook] Enabling autocreate for " \
                     "authentication strategies #{ALLOWED_AUTH_STRATEGIES.inspect} " \
                     "with VOs #{@vo_names.inspect}"
end

Public Instance Methods

call(env) click to toggle source

Trigger hook execution for a specific incoming request represented by env. After the hook has been executed the control is passed back to the application.

@param env [Object] request environment

# File lib/hooks/oneuser_autocreate_hook.rb, line 26
def call(env)
  # get the request and explore it
  request = ::ActionDispatch::Request.new(env)
  start_autocreate(request) unless @vo_names.blank?

  # pass control back to the application
  @app.call(env)
end