module Authz

Stores the configuration parameters of the library @api public

Constants

VERSION

Public Class Methods

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

Allows the configuration of the gem using block syntax @example

Authz.configure do |config|
  config.current_user_method = :current_user
end
# File lib/authz.rb, line 63
def self.configure
  yield self
end
register_rolable(rolable) click to toggle source

Adds a rolable to the configuration @param rolable [Rolable] rolable class @api private

# File lib/authz.rb, line 29
def self.register_rolable(rolable)
  unless @@rolables.map{|r| r.model_name.name}.include?(rolable.model_name.name)
    @@rolables << rolable
  end

  # TODO: When support for multiple rolables is implemented, lift this exception
  if @@rolables.size > 1
    raise MultileRolablesNotPermitted,
          "Only the Authorization of one model (like a User) is currently supported"
  end
end