view->getUser(); if (!$account->hasPermission('bypass node access')) { $table = $this->ensureMyTable(); $grants = new Condition('OR'); foreach (node_access_grants('view', $account) as $realm => $gids) { foreach ($gids as $gid) { $grants->condition((new Condition('AND')) ->condition($table . '.gid', $gid) ->condition($table . '.realm', $realm) ); } } $this->query->addWhere('AND', $grants); $this->query->addWhere('AND', $table . '.grant_view', 1, '>='); } } /** * {@inheritdoc} */ public function getCacheContexts() { $contexts = parent::getCacheContexts(); $contexts[] = 'user.node_grants:view'; return $contexts; } }