diff --git a/core/modules/comment/src/CommentAccessController.php b/core/modules/comment/src/CommentAccessController.php index 5f169f3..d741d86 100644 --- a/core/modules/comment/src/CommentAccessController.php +++ b/core/modules/comment/src/CommentAccessController.php @@ -26,7 +26,7 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A switch ($operation) { case 'view': if ($account->hasPermission('access comments') && $entity->isPublished() || $account->hasPermission('administer comments')) { - return $entity->getCommentedEntity()->access($operation); + return $entity->getCommentedEntity()->access($operation, $account); } break; diff --git a/core/modules/file/src/Tests/FilePrivateTest.php b/core/modules/file/src/Tests/FilePrivateTest.php index 62da399..cd30991 100644 --- a/core/modules/file/src/Tests/FilePrivateTest.php +++ b/core/modules/file/src/Tests/FilePrivateTest.php @@ -57,9 +57,13 @@ function testPrivateFile() { // Test with the field that should deny access through field access. $this->drupalLogin($this->admin_user); $nid = $this->uploadNodeFile($test_file, $no_access_field_name, $type_name, TRUE, array('private' => TRUE)); - $node = node_load($nid, TRUE); - $node_file = file_load($node->{$no_access_field_name}->target_id); + \Drupal::entityManager()->getStorage('node')->resetCache(array($nid)); + $node = Node::load($nid); + $node_file = File::load($node->{$no_access_field_name}->target_id); + // Ensure the file cannot be downloaded. + $user = $this->drupalCreateUser(array('access content')); + $this->drupalLogin($user); $this->drupalGet(file_create_url($node_file->getFileUri())); $this->assertResponse(403, 'Confirmed that access is denied for the file without view field access permission.'); }