diff --git a/core/modules/book/book.module b/core/modules/book/book.module index fe6e06d..51da823 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -238,6 +238,10 @@ function book_node_load($nodes) { function book_node_view(array &$build, EntityInterface $node, EntityViewDisplayInterface $display, $view_mode) { if ($view_mode == 'full') { if (!empty($node->book['bid']) && empty($node->in_preview)) { + $book_node = Node::load($node->book['bid']); + if (!$book_node->access()) { + return; + } $book_navigation = array( '#theme' => 'book_navigation', '#book_link' => $node->book); $build['book_navigation'] = array( '#markup' => drupal_render($book_navigation), diff --git a/core/modules/book/src/BookOutlineStorage.php b/core/modules/book/src/BookOutlineStorage.php index 8e8271d..abce1c2 100644 --- a/core/modules/book/src/BookOutlineStorage.php +++ b/core/modules/book/src/BookOutlineStorage.php @@ -47,11 +47,15 @@ public function hasBooks() { /** * {@inheritdoc} */ - public function loadMultiple($nids) { + public function loadMultiple($nids, $access = TRUE) { $query = $this->connection->select('book', 'b', array('fetch' => \PDO::FETCH_ASSOC)); $query->fields('b'); $query->condition('b.nid', $nids); - $query->addTag('node_access'); + + if ($access) { + $query->addTag('node_access'); + } + $query->addMetaData('base_table', 'book'); return $query->execute(); } diff --git a/core/modules/book/src/BookOutlineStorageInterface.php b/core/modules/book/src/BookOutlineStorageInterface.php index e08fab6..c03f3aa 100644 --- a/core/modules/book/src/BookOutlineStorageInterface.php +++ b/core/modules/book/src/BookOutlineStorageInterface.php @@ -33,11 +33,13 @@ public function hasBooks(); * * @param array $nids * An array of node IDs. + * @param bool $access + * Whether access checking should be taken into account * - * @return array - * Array of loaded book items. + * @return array Array of loaded book items. + * Array of loaded book items. */ - public function loadMultiple($nids); + public function loadMultiple($nids, $access = TRUE); /** * Gets child relative depth.