File src/Integration/DynamicAccess.php
class Phad\Integration\DynamicAccess
A base class for access controls that allows all READ operations, no WRITE (insert/update/delete) operations, and returns false for user_has_role().
See source code at /src/Integration/DynamicAccess.php
Constants
Properties
-
public $item_initialized;callable foritem_initialized() -
public $call;callable forcall(). This is only called ifcall_handlers[]does not have a matching handler. -
public $can_read_row;callable forcan_read_row() -
public $user_has_role;callable forcan_read_row() -
public array $call_handlers = [];Array of call handlers. Key is thewhatincall:what, and value is a callable with the same method signature as call()
Methods
-
public function item_initialized(object $ItemInfo): voidDoes nothing unless you set a custom handler -
public function call(\Phad\Caller $caller, string $what, object $ItemInfo, ...$args): boolWhencall:somethingis added to theaccessattribute of a node, this method is called and must return true or false. -
public function can_read_row(array $ItemRow, object $ItemInfo, string $ItemName): boolWhen a template's data is being loaded, either via a query (default) or a custom data_loader, every row is passed to this method. For each row that returnstrue, it will be included in the final resultset.
If data is passed to your template (rather than loaded by the template), then this method will not be called.
-
public function user_has_role(string $role): boolCheck if the currently logged-in user has the given role. You may use this to check multiple roles, likerole:a&b&cor you can use multiple separate role checks likerole:a;role:b;role:c