Class: Authority::Authorizer

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/authority/authorizer.rb

Direct Known Subclasses

ApplicationAuthorizer

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ Authorizer



14
15
16
# File 'lib/authority/authorizer.rb', line 14

def initialize(resource)
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

The base Authorizer class, from which all the authorizers in an app will descend. Provides the authorizer with both class and instance methods like `updatable_by?(user)`. Exactly which methods get defined is determined from `config.abilities`; the class is evaluated after any user-supplied config block is run in order to make that possible.



12
13
14
# File 'lib/authority/authorizer.rb', line 12

def resource
  @resource
end

Class Method Details

.default(adjective, user, options = {}) ⇒ Object

Whitelisting approach: anything not specified will be forbidden



19
20
21
# File 'lib/authority/authorizer.rb', line 19

def self.default(adjective, user, options = {})
  false
end