diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2011-07-27 13:16:17 -0700 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2011-07-27 13:16:17 -0700 |
commit | b38a806c16a0209e111aa832b8dc12fded1471ce (patch) | |
tree | 0b3d64857d18064c894fa081e22c26c4e0da2074 /modules | |
parent | 4cede694ab76a1e02bacb9c79d89d8bd4659a842 (diff) | |
download | brdo-b38a806c16a0209e111aa832b8dc12fded1471ce.tar.gz brdo-b38a806c16a0209e111aa832b8dc12fded1471ce.tar.bz2 |
Drupal 7.5
Diffstat (limited to 'modules')
-rw-r--r-- | modules/comment/comment.module | 6 | ||||
-rw-r--r-- | modules/file/tests/file.test | 13 |
2 files changed, 18 insertions, 1 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 8d0c3d362..9c31f4427 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -2681,6 +2681,10 @@ function comment_rdf_mapping() { */ function comment_file_download_access($field, $entity_type, $entity) { if ($entity_type == 'comment') { - return user_access('access comments') && $entity->status == COMMENT_PUBLISHED || user_access('administer comments'); + if (user_access('access comments') && $entity->status == COMMENT_PUBLISHED || user_access('administer comments')) { + $node = node_load($entity->nid); + return node_access('view', $node); + } + return FALSE; } } diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test index ea8c5c67b..044c6f698 100644 --- a/modules/file/tests/file.test +++ b/modules/file/tests/file.test @@ -530,6 +530,7 @@ class FileFieldWidgetTestCase extends FileFieldTestCase { 'title' => $this->randomName(), ); $this->drupalPost('node/add/article', $edit, t('Save')); + $node = $this->drupalGetNodeByTitle($edit['title']); // Add a comment with a file. $text_file = $this->getTestFile('text'); @@ -559,6 +560,18 @@ class FileFieldWidgetTestCase extends FileFieldTestCase { $this->drupalLogout(); $this->drupalGet(file_create_url($comment_file->uri)); $this->assertResponse(403, t('Confirmed that access is denied for the file without the needed permission.')); + + // Unpublishes node. + $this->drupalLogin($this->admin_user); + $edit = array( + 'status' => FALSE, + ); + $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save')); + + // Ensures normal user can no longer download the file. + $this->drupalLogin($user); + $this->drupalGet(file_create_url($comment_file->uri)); + $this->assertResponse(403, t('Confirmed that access is denied for the file without the needed permission.')); } } |