Sha256: b3c1c27270ef8d8088234cf9426ea00ac9741ea51f36038a0ae8e938aefdd3a6
Contents?: true
Size: 1.85 KB
Versions: 3
Compression:
Stored size: 1.85 KB
Contents
require 'authz/engine' require 'authz/cache' require 'authz/models/rolable' require 'authz/controllers/scoping_manager' require 'authz/controllers/authorization_manager' require 'authz/helpers/view_helpers' require 'authz/scopables/base' require 'slim-rails' require 'kaminari' require 'jquery-rails' require 'font-awesome-rails' # Stores the configuration parameters of the library # @api public module Authz # Error that will be raised when multiple rolables are being used. class MultileRolablesNotPermitted < StandardError; end # @return [Rolable] classes of al rolables # @api private mattr_reader :rolables @@rolables = [] # Adds a rolable to the configuration # @param rolable [Rolable] rolable class # @api private 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 mattr_accessor :force_authentication_method # The method controllers use to force authentication @@force_authentication_method = :authenticate_user! mattr_accessor :current_user_method # The method used to access the instance of a current user @@current_user_method = :current_user mattr_accessor :cross_request_caching # Configuration to enable cross request caching @@cross_request_caching = false mattr_reader :cache # The attribute that points to the cache module @@cache = Authz::Cache # Allows the configuration of the gem using # block syntax # @example # Authz.configure do |config| # config.current_user_method = :current_user # end def self.configure yield self end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
authz-0.0.5 | lib/authz.rb |
authz-0.0.4 | lib/authz.rb |
authz-0.0.3 | lib/authz.rb |