Module: Doorman

Defined in:
lib/rails_doorman.rb,
lib/rails_doorman/rule.rb,
lib/rails_doorman/helpers.rb

Defined Under Namespace

Modules: ClassMethods, Helpers, InstanceMethods, SharedMethods Classes: InvalidRule, Rule, Unauthorized

Constant Summary collapse

SUPPORTED_METHODS =
[:block, :host, :role, :user, :user_agent].freeze

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/rails_doorman.rb', line 21

def included(base)
  base.extend(ClassMethods)
  base.class_eval do
    include InstanceMethods
    include SharedMethods
    helper Doorman::SharedMethods, Doorman::Helpers
    before_filter :_doorman_check_acl
  end
end

.optionsObject



8
9
10
11
12
13
# File 'lib/rails_doorman.rb', line 8

def options
  @options ||= {
    :user_identifier_method => :login,
    :has_role_method => :has_role?
  }
end

.supported_method?(method) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/rails_doorman.rb', line 17

def supported_method?(method)
  SUPPORTED_METHODS.include?(method)
end