Skip to content
Snippets Groups Projects

Issue #3201661: Access denied on node preview page when the user cannot access the new revision

Open Issue #3201661: Access denied on node preview page when the user cannot access the new revision
Open Sachiko Nitta requested to merge issue/drupal-3201661:3201661-access-denied-on into 9.2.x
1 file
+ 10
1
Compare changes
  • Side-by-side
  • Inline
@@ -48,7 +48,16 @@ public function access(AccountInterface $account, NodeInterface $node_preview) {
return $access_controller->createAccess($node_preview->bundle(), $account, [], TRUE);
}
else {
return $node_preview->access('update', $account, TRUE);
$nid = $node_preview->id();
/** @var \Drupal\node\NodeStorageInterface $storage */
$storage = \Drupal::entityTypeManager()->getStorage('node');
$vid = $storage->getLatestRevisionId($nid);
/** @var \Drupal\node\NodeInterface $latest_revision */
$latest_revision = \Drupal::entityTypeManager()->getStorage('node')
->loadRevision($vid);
return $latest_revision->access('update', $account, TRUE);
}
}
Loading