dolibarr 25.0.0-alpha
AccessPolicyEvaluator Class Reference

Evaluates the rule tree of an access policy. More...

Inheritance diagram for AccessPolicyEvaluator:
Collaboration diagram for AccessPolicyEvaluator:

Public Member Functions

 __construct (AccessPolicyConfig $policy)
 
 evaluate (User $user, CommonObject $obj)
 

Private Member Functions

 evaluateNode (AccessRuleExpression $node, User $user, CommonObject $obj)
 
 evaluatePredicate (string $name, User $user, CommonObject $obj)
 

Detailed Description

Evaluates the rule tree of an access policy.

This is the reference semantics of the PHP block rendered into the generated pages: both must grant the same access to the same user.

Definition at line 32 of file AccessPolicyEvaluator.class.php.

Constructor & Destructor Documentation

◆ __construct()

AccessPolicyEvaluator::__construct ( AccessPolicyConfig $policy)
Parameters
AccessPolicyConfig$policyPolicy to evaluate

Definition at line 40 of file AccessPolicyEvaluator.class.php.

Member Function Documentation

◆ evaluate()

AccessPolicyEvaluator::evaluate ( User $user,
CommonObject $obj )
Parameters
User$userUser asking for the access
CommonObject$objObject to access, it provides the module and element of the permissions
Returns
bool True when the access is granted, false otherwise, including on failure

Implements AccessRuleEvaluator.

Definition at line 50 of file AccessPolicyEvaluator.class.php.

References dol_syslog(), and evaluateNode().

◆ evaluateNode()

AccessPolicyEvaluator::evaluateNode ( AccessRuleExpression $node,
User $user,
CommonObject $obj )
private
Parameters
AccessRuleExpression$nodeNode to evaluate
User$userUser asking for the access
CommonObject$objObject to access
Returns
bool True if the node grants the access
Exceptions

LogicException When the node or the predicate is unknown

Definition at line 67 of file AccessPolicyEvaluator.class.php.

References evaluateNode(), and evaluatePredicate().

Referenced by evaluate(), and evaluateNode().

◆ evaluatePredicate()

AccessPolicyEvaluator::evaluatePredicate ( string $name,
User $user,
CommonObject $obj )
private
Parameters
string$nameName of the predicate
User$userUser asking for the access
CommonObject$objObject to access
Returns
bool True if the predicate is satisfied
Exceptions

LogicException When the predicate is unknown

Definition at line 98 of file AccessPolicyEvaluator.class.php.

Referenced by evaluateNode().


The documentation for this class was generated from the following file: