Class: Authority::Configuration

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Configuration) initialize



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

- (Object) abilities

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



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

def abilities
  @abilities
end

- (Object) controller_action_map

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

- (Object) logger

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



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

def logger
  @logger
end

- (Object) security_violation_handler

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

- (Object) user_method

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

- (Object) default_strategy=(val)

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