src/Rbac/DbManager.php
public function checkAccess($userId, $permissionName, $params = [])
    {
        //TODO: rewrite static cache of assignments
        if (isset($this->_checkAccessAssignments[(string)$userId])) {
            $basePromise = new Reaction\Promise\Promise(function($r) use ($userId) {
                $r($this->_checkAccessAssignments[(string)$userId]);
            });
        } else {
            $basePromise = $this->getAssignments($userId);
        }

        $assignments = [];
        return $basePromise->then(function($_assignments) use (&$assignments, $userId) {
            if ($this->hasNoAssignments($_assignments)) {
                return reject(new Error("Check access - denied"));
            }
            $assignments = $_assignments;
            $this->_checkAccessAssignments[(string)$userId] = $assignments;
            return $this->loadFromCache();
        })->then(function() use ($userId, $permissionName, $params, &$assignments) {
            if ($this->items !== null) {
                return $this->checkAccessFromCache($userId, $permissionName, $params, $assignments);
            }
            return $this->checkAccessRecursive($userId, $permissionName, $params, $assignments);
        });
    }
public function checkAccess($userId, $permissionName, $params = [])
    {
        //TODO: rewrite static cache of assignments
        if (isset($this->_checkAccessAssignments[(string)$userId])) {
            $basePromise = new Reaction\Promise\Promise(function($r) use ($userId) {
                $r($this->_checkAccessAssignments[(string)$userId]);
            });
        } else {
            $basePromise = $this->getAssignments($userId);
        }

        $assignments = [];
        return $basePromise->then(function($_assignments) use (&$assignments, $userId) {
            if ($this->hasNoAssignments($_assignments)) {
                return reject(new Error("Check access - denied"));
            }
            $assignments = $_assignments;
            $this->_checkAccessAssignments[(string)$userId] = $assignments;
            return $this->loadFromCache();
        })->then(function() use ($userId, $permissionName, $params, &$assignments) {
            if ($this->items !== null) {
                return $this->checkAccessFromCache($userId, $permissionName, $params, $assignments);
            }
            return $this->checkAccessRecursive($userId, $permissionName, $params, $assignments);
        });
    }
{@inheritdoc}