checkAccessRecursive() protected method

This method is internally called by DbManager::checkAccess.
protected checkAccessRecursive ( 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
return boolean whether the operations can be performed by the user.
Beispiel #1
0
 /**
  * @inheritdoc
  */
 protected function checkAccessRecursive($user, $itemName, $params, $assignments)
 {
     $cacheKey = 'checkAccessRecursive:' . $user . ':' . $itemName;
     if (!empty($params)) {
         $cacheKey .= ':' . current($params)->primaryKey;
     }
     $cached = $this->getCache($cacheKey);
     if (empty($cached)) {
         $cached = parent::checkAccessRecursive($user, $itemName, $params, $assignments);
         $this->setCache($cacheKey, $cached);
     }
     return $cached;
 }