module Granite::Action::Policies
Policies
module used for abilities definition. Basically policies are defined as blocks which are executed in action instance context, so performer, object and all the attributes are available inside the block.
By default action is allowed to be performed only by default performer.
Public Instance Methods
allowed?()
click to toggle source
Returns true if any of defined policies returns true
# File lib/granite/action/policies.rb, line 75 def allowed? @allowed = _policies_strategy.allowed?(self) unless instance_variable_defined?(:@allowed) @allowed end
perform(*, **)
click to toggle source
Calls superclass method
# File lib/granite/action/policies.rb, line 63 def perform(*, **) authorize! super end
perform!(*, **)
click to toggle source
Calls superclass method
# File lib/granite/action/policies.rb, line 68 def perform!(*, **) authorize! super end
try_perform!(*, **)
click to toggle source
Calls superclass method
# File lib/granite/action/policies.rb, line 58 def try_perform!(*, **) authorize! super end