Class: DeadSimpleAuthorization::Policy::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dead_simple_authorization/policy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, user) ⇒ Base

The resource (e.g. a model) and user objects are available in all Policy objects that inherit from BasePolicy and can be used by authorize action methods.



11
12
13
14
# File 'lib/dead_simple_authorization/policy.rb', line 11

def initialize(resource, user)
  @user = user
  @resource = resource
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



4
5
6
# File 'lib/dead_simple_authorization/policy.rb', line 4

def resource
  @resource
end

#userObject (readonly)

Returns the value of attribute user.



5
6
7
# File 'lib/dead_simple_authorization/policy.rb', line 5

def user
  @user
end