summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-01-26 13:26:03 -0800
committerBharat Mediratta <bharat@menalto.com>2010-01-26 13:29:22 -0800
commitc5cdd13b41c2911390a67e22700fa414dfe53ea2 (patch)
tree76771b36376ad9d863097cead995150a75d4d419 /modules
parentf268128043a56888ef35d07ee5d02012b8349c74 (diff)
Added view_permissions_propagate_down_to_photos_test().
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/tests/Access_Helper_Test.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/gallery/tests/Access_Helper_Test.php b/modules/gallery/tests/Access_Helper_Test.php
index 7ddd2875..35cf5edb 100644
--- a/modules/gallery/tests/Access_Helper_Test.php
+++ b/modules/gallery/tests/Access_Helper_Test.php
@@ -193,6 +193,18 @@ class Access_Helper_Test extends Gallery_Unit_Test_Case {
$this->assert_true(access::group_can(identity::everybody(), "view", $album));
}
+ public function view_permissions_propagate_down_to_photos_test() {
+ $album = album::create(item::root(), rand(), "test album");
+ $photo = photo::create($album, MODPATH . "gallery/images/gallery.png", "", "");
+ identity::set_active_user(identity::guest());
+
+ $this->assert_true(access::can("view", $photo));
+ access::deny(identity::everybody(), "view", $album);
+
+ $photo->reload(); // view permissions are cached in the photo
+ $this->assert_false(access::can("view", $photo));
+ }
+
public function can_toggle_view_permissions_propagate_down_test() {
$album1 = test::random_album(item::root());
$album2 = test::random_album($album1);