protected function checkNodeGrants($operation) { // When checking the grants for the 'view' operation and the current user
// has a global view grant (i.e. a view grant for node ID 0) — note that
// this is automatically the case if no node access modules exist (no
// hook_node_grants() implementations) then we don't need to determine the
// exact node view grants for the current user.
if ($operation === 'view' &&
node_access_view_all_nodes($this->user
)) { return 'view.all';
} $grants =
node_access_grants($operation,
$this->user
);
$grants_context_parts =
[];
foreach ($grants as $realm =>
$gids) { $grants_context_parts[] =
$realm . ':' .
implode(',',
$gids);
} return $operation . '.' .
implode(';',
$grants_context_parts);
}