yii\rbac\DbManager::checkAccessFromCache PHP Метод

checkAccessFromCache() защищенный Метод

This method is internally called by DbManager::checkAccess when [[cache]] is enabled.
С версии: 2.0.3
protected checkAccessFromCache ( string | integer $user, string $itemName, array $params, Assignment[] $assignments ) : boolean
$user string | integer the user ID. This should can be either an integer or a string representing the unique identifier of a user. See [[\yii\web\User::id]].
$itemName string the name of the operation that need access check
$params array name-value pairs that would be passed to rules associated with the tasks and roles assigned to the user. A param with name 'user' is added to this array, which holds the value of `$userId`.
$assignments Assignment[] the assignments to the specified user
Результат boolean whether the operations can be performed by the user.
    protected function checkAccessFromCache($user, $itemName, $params, $assignments)
    {
        if (!isset($this->items[$itemName])) {
            return false;
        }
        $item = $this->items[$itemName];
        Yii::trace($item instanceof Role ? "Checking role: {$itemName}" : "Checking permission: {$itemName}", __METHOD__);
        if (!$this->executeRule($user, $item, $params)) {
            return false;
        }
        if (isset($assignments[$itemName]) || in_array($itemName, $this->defaultRoles)) {
            return true;
        }
        if (!empty($this->parents[$itemName])) {
            foreach ($this->parents[$itemName] as $parent) {
                if ($this->checkAccessFromCache($user, $parent, $params, $assignments)) {
                    return true;
                }
            }
        }
        return false;
    }