Bristol SU Support Package
|
Public Member Functions | |
evaluate (string $ability) | |
evaluateFor (string $ability, ?User $user=null, ?Group $group=null, ?Role $role=null) | |
getChain () | |
register (Tester $tester, $position=null) | |
![]() | |
evaluateFor (string $ability, ?User $userModel, ?Group $group, ?Role $role) | |
register (Tester $tester) | |
Private Member Functions | |
getPermission (string $ability) | |
Private Attributes | |
$testers = [] | |
Test if credentials have permissions
Definition at line 20 of file PermissionTester.php.
BristolSU\Support\Permissions\PermissionTester::evaluate | ( | string | $ability | ) |
Evaluate a permission using the currently authenticated credentials.
string | $ability | Ability to test |
Exception | If no testers are registered |
Implements BristolSU\Support\Permissions\Contracts\PermissionTester.
Definition at line 37 of file PermissionTester.php.
References BristolSU\Support\Permissions\PermissionTester\evaluateFor().
BristolSU\Support\Permissions\PermissionTester::evaluateFor | ( | string | $ability, |
?User | $user = null , |
||
?Group | $group = null , |
||
?Role | $role = null |
||
) |
Evaluate a permission for the given credentials.
string | $ability | Ability to test |
User | null | $user | User to test the ability on |
Group | null | $group | Group to test the ability on |
Role | null | $role | Role to test the ability on |
Exception | If no testers are registered |
Definition at line 62 of file PermissionTester.php.
References BristolSU\Support\Permissions\PermissionTester\getChain().
Referenced by BristolSU\Support\Permissions\PermissionTester\evaluate().
BristolSU\Support\Permissions\PermissionTester::getChain | ( | ) |
Gets the tester chain
This returns the first registered tester. This tester will have a successor of the first tester, which in turn will have a successor of the second tester etc.
Exception | If no testers are registered |
Definition at line 77 of file PermissionTester.php.
References BristolSU\Support\Permissions\PermissionTester\$testers.
Referenced by BristolSU\Support\Permissions\PermissionTester\evaluateFor().
|
private |
Get a permission from the ability
string | $ability | Ability of the permission |
Definition at line 95 of file PermissionTester.php.
BristolSU\Support\Permissions\PermissionTester::register | ( | Tester | $tester, |
$position = null |
|||
) |
Register a new tester
Tester | $tester | Tester to register |
null | $position | Position to insert the tester into. i.e. 0 will put the tester first. |
Definition at line 106 of file PermissionTester.php.
|
private |
Definition at line 28 of file PermissionTester.php.
Referenced by BristolSU\Support\Permissions\PermissionTester\getChain().