Interface Yiisoft\Access\AccessCheckerInterface
| Implemented by | Yiisoft\Access\AllowAll, Yiisoft\Access\DenyAll |
|---|
The interface defines checking if certain user has certain permission. Optional parameters could be passed for fine-grained access checks.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| userHasPermission() | Checks if the user with the ID given has the specified permission. | Yiisoft\Access\AccessCheckerInterface |
Method Details
Checks if the user with the ID given has the specified permission.
| public abstract boolean userHasPermission ( integer|string|\Stringable|null $userId, string $permissionName, array $parameters = [] ) | ||
| $userId | integer|string|\Stringable|null |
The user ID representing the unique identifier of a user. If ID is null, it means user is a guest. |
| $permissionName | string |
The name of the permission to be checked against. |
| $parameters | array |
Name-value pairs that will be used to determine if access is granted. |
| return | boolean |
Whether the user has the specified permission. |
|---|---|---|
| throws | InvalidArgumentException |
If any of argument is not of the expected type or does not refer to an existing value. |
public function userHasPermission(int|string|Stringable|null $userId, string $permissionName, array $parameters = []): bool;
Signup or Login in order to comment.