/**
  * {@inheritdoc}
  */
 protected function checkAccess(EntityInterface $node, $operation, $langcode, AccountInterface $account)
 {
     /** @var \Drupal\node\NodeInterface $node */
     /** @var \Drupal\node\NodeInterface $translation */
     $translation = $node->getTranslation($langcode);
     // Fetch information from the node object if possible.
     $status = $translation->isPublished();
     $uid = $translation->getOwnerId();
     // Check if authors can view their own unpublished nodes.
     if ($operation === 'view' && !$status && $account->hasPermission('view own unpublished content') && $account->isAuthenticated() && $account->id() == $uid) {
         return AccessResult::allowed()->cachePerRole()->cachePerUser()->cacheUntilEntityChanges($node);
     }
     // If no module specified either ALLOW or KILL, we fall back to the
     // node_access table.
     $grants = $this->grantStorage->access($node, $operation, $langcode, $account);
     if ($grants->isAllowed() || $grants->isForbidden()) {
         return $grants;
     }
     // If no modules implement hook_node_grants(), the default behavior is to
     // allow all users to view published nodes, so reflect that here.
     if ($operation === 'view') {
         return AccessResult::allowedIf($status)->cacheUntilEntityChanges($node);
     }
     // No opinion.
     return AccessResult::neutral();
 }
 /**
  * {@inheritdoc}
  */
 protected function checkAccess(EntityInterface $node, $operation, AccountInterface $account)
 {
     /** @var \Drupal\node\NodeInterface $node */
     // Fetch information from the node object if possible.
     $status = $node->isPublished();
     $uid = $node->getOwnerId();
     // Check if authors can view their own unpublished nodes.
     if ($operation === 'view' && !$status && $account->hasPermission('view own unpublished content') && $account->isAuthenticated() && $account->id() == $uid) {
         return AccessResult::allowed()->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
     }
     // Evaluate node grants.
     return $this->grantStorage->access($node, $operation, $account);
 }