Skip to content
PHP Ecosystem
Explore

CheckAccessInterface

API reference › yii › rbac › CheckAccessInterface

interfaceyii\rbac\CheckAccessInterface
Since2.0.9
Sourceframework/rbac/CheckAccessInterface.php
Implemented by 1 type

For more details and usage information on CheckAccessInterface, see the guide article on security authorization.

MethodDescriptionDefined by
checkAccess() abstractChecks if the user has the specified permission.CheckAccessInterface
abstract public function checkAccess(string|int $userId, string $permissionName, array $params = []): bool

Checks if the user has the specified permission.

Parameters

ParameterTypeDescription
$userIdstring|intThe user ID. This should be either an integer or a string representing the unique identifier of a user. See User::$id.
$permissionNamestringThe name of the permission to be checked against
$paramsarrayName-value pairs that will be passed to the rules associated with the roles and permissions assigned to the user.

Returns

bool: Whether the user has the specified permission.

Throws