Class: RoadForest::Authorization::Policy

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

Overview

Responsible to assigning particular permission grants to entities. There should be one subclass of Policy per application, ideally.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#grants_holderObject

Returns the value of attribute grants_holder.



6
7
8
# File 'lib/roadforest/authorization/policy.rb', line 6

def grants_holder
  @grants_holder
end

Instance Method Details

#build_grants(&block) ⇒ Object



8
9
10
# File 'lib/roadforest/authorization/policy.rb', line 8

def build_grants(&block)
  grants_holder.build_grants(&block)
end

#grants_for(entity) ⇒ Object



12
13
14
15
16
# File 'lib/roadforest/authorization/policy.rb', line 12

def grants_for(entity)
  build_grants do |builder|
    builder.add(:admin)
  end
end