Class: Authority::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/authority/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/authority/configuration.rb', line 8

def initialize

  @abilities = {
    :create => 'creatable',
    :read   => 'readable',
    :update => 'updatable',
    :delete => 'deletable'
  }

  @controller_action_map = {
    :index   => 'read',
    :show    => 'read',
    :new     => 'create',
    :create  => 'create',
    :edit    => 'update',
    :update  => 'update',
    :destroy => 'delete'
  }

  @user_method = :current_user

  @security_violation_handler = :authority_forbidden

  @logger = Logger.new(STDERR)
end

Instance Attribute Details

#abilitiesObject

Has default settings, which can be overridden in the initializer.



6
7
8
# File 'lib/authority/configuration.rb', line 6

def abilities
  @abilities
end

#controller_action_mapObject

Has default settings, which can be overridden in the initializer.



6
7
8
# File 'lib/authority/configuration.rb', line 6

def controller_action_map
  @controller_action_map
end

#loggerObject

Has default settings, which can be overridden in the initializer.



6
7
8
# File 'lib/authority/configuration.rb', line 6

def logger
  @logger
end

#security_violation_handlerObject

Has default settings, which can be overridden in the initializer.



6
7
8
# File 'lib/authority/configuration.rb', line 6

def security_violation_handler
  @security_violation_handler
end

#user_methodObject

Has default settings, which can be overridden in the initializer.



6
7
8
# File 'lib/authority/configuration.rb', line 6

def user_method
  @user_method
end

Instance Method Details

#default_strategy=(val) ⇒ Object

Raises:

  • (ArgumentError)


34
35
36
# File 'lib/authority/configuration.rb', line 34

def default_strategy=(val)
  raise ArgumentError, "`config.default_strategy=` was removed in Authority 2.0; see README and CHANGELOG"
end