module Gatekeeper

Constants

VERSION

Attributes

configuration[RW]

@return [Gatekeeper::Configuration] the configuration class for Gatekeeper.

Public Class Methods

configure() { |configuration| ... } click to toggle source

Method to configure various Gatekeeper options.

@return [nil]

# File lib/gatekeeper.rb, line 23
def configure
  @configuration ||= Gatekeeper::Configuration.new
  yield @configuration
end
default_allowed_info_names(user, model_class, &block) click to toggle source

Returns default allowed info names for a user.

@param [Object] the user. @param [Class] the model class.

@return [Array<Symbol>] default allowed info names.

# File lib/gatekeeper.rb, line 35
def default_allowed_info_names(user, model_class, &block)
  if configuration.bypass_allowed_info.respond_to? :call
    bypassable = configuration.bypass_allowed_info.call(user)
  else
    bypassable = false
  end

  if bypassable
    # Sees everything!
    model_class.document_all_info
  else
    if block_given?
      block.call(user) || []
    else
      []
    end
  end
end
response_ignored_variables() click to toggle source

Variables to not include in controller response.

@return [Array<Symbol>] ignored variables.

# File lib/gatekeeper.rb, line 58
def response_ignored_variables
  Gatekeeper.configuration.response_ignored_variables | [
    :@marked_for_same_origin_verification, :@browser,
    :@behavior, :@options, :@args, :@shell, :@destination_stack ]
end