PHP Class Devise\Users\Permissions\RuleManager

Datei anzeigen Open project: devisephp/cms Class Usage Examples

Protected Properties

Property Type Description
$Framework Devise\Support\Framework Framework components being used from Laravel's framework
$RedirectHandler RedirectHandler RedirectHandler redirects user-defined permission conditions
$RuleList RuleList RuleList fetches list of rules

Public Methods

Method Description
__construct ( RedirectHandler $RedirectHandler, Framework $Framework ) Construct a new rule manager
addRule ( string $rule, callback $closure = null ) : Void Add new element to rules array
evaluateResults ( $results, boolean $redirectOnFail, object $conditionObject ) : boolean Determines if access allowed/denied by checking results array for any occurences of a "false" value
executeCondition ( object $conditionObject ) : array Executes conditions one at a time and returns result
getClosure ( string $method ) : Array Get all closures
getCondition ( string $conditionName ) : Void Retrieve conditions JSON from permission conditions config
getNumberOfRequiredParametersForRule ( $ruleName ) : integer Get all rules
getRules ( ) : Array Get all rules
overwriteRule ( string $rule, callback $closure = null ) : Void Add replaces element in rules array
runCondition ( string $conditionName, boolean $redirectOnFail, boolean $evaluateResults = true ) : Void Begins condition checking process by retrieving condition by name/key and then executing its contents.

Private Methods

Method Description
parseCondition ( &$conditions, $parentOperator = null ) : Void Iterate thru conditions and determines if condition is true or false
ruleNameAvailable ( string $rule ) : boolean Checks rules array to see if rule/function name has already been used for rule

Method Details

__construct() public method

Construct a new rule manager
public __construct ( RedirectHandler $RedirectHandler, Framework $Framework )
$RedirectHandler RedirectHandler
$Framework Devise\Support\Framework

addRule() public method

Add new element to rules array
public addRule ( string $rule, callback $closure = null ) : Void
$rule string
$closure callback
return Void

evaluateResults() public method

Determines if access allowed/denied by checking results array for any occurences of a "false" value
public evaluateResults ( $results, boolean $redirectOnFail, object $conditionObject ) : boolean
$redirectOnFail boolean
$conditionObject object
return boolean

executeCondition() public method

Executes conditions one at a time and returns result
public executeCondition ( object $conditionObject ) : array
$conditionObject object
return array

getClosure() public method

Get all closures
public getClosure ( string $method ) : Array
$method string
return Array

getCondition() public method

Retrieve conditions JSON from permission conditions config
public getCondition ( string $conditionName ) : Void
$conditionName string
return Void

getNumberOfRequiredParametersForRule() public method

Get all rules
public getNumberOfRequiredParametersForRule ( $ruleName ) : integer
return integer

getRules() public method

Get all rules
public getRules ( ) : Array
return Array

overwriteRule() public method

Add replaces element in rules array
public overwriteRule ( string $rule, callback $closure = null ) : Void
$rule string
$closure callback
return Void

runCondition() public method

Begins condition checking process by retrieving condition by name/key and then executing its contents.
public runCondition ( string $conditionName, boolean $redirectOnFail, boolean $evaluateResults = true ) : Void
$conditionName string
$redirectOnFail boolean
$evaluateResults boolean If false, evaluateResults() omitted
return Void

Property Details

$Framework protected_oe property

Framework components being used from Laravel's framework
protected Framework,Devise\Support $Framework
return Devise\Support\Framework

$RedirectHandler protected_oe property

RedirectHandler redirects user-defined permission conditions
protected RedirectHandler,Devise\Users\Permissions $RedirectHandler
return RedirectHandler

$RuleList protected_oe property

RuleList fetches list of rules
protected RuleList,Devise\Users\Permissions $RuleList
return RuleList