From af8c74f6125478450072fd105d54172dcba1bf8e Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 13 Dec 2008 20:06:20 +0000 Subject: Fix a bug where parent permissions were not getting inherited to newly created albums and photos. --- core/tests/Access_Helper_Test.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'core/tests') diff --git a/core/tests/Access_Helper_Test.php b/core/tests/Access_Helper_Test.php index 7f5aa656..9b08b2cd 100644 --- a/core/tests/Access_Helper_Test.php +++ b/core/tests/Access_Helper_Test.php @@ -81,6 +81,23 @@ class Access_Helper_Test extends Unit_Test_Case { $item->delete(); } + public function new_photos_inherit_parent_permissions_test() { + $root = ORM::factory("item", 1); + + $album = ORM::factory("item"); + $album->type = "album"; + $album->add_to_parent($root); + access::add_item($album); + access::allow(group::everybody(), "view", $album); + + $photo = ORM::factory("item"); + $photo->type = "photo"; + $photo->add_to_parent($album); + access::add_item($photo); + + $this->assert_true($photo->__get("view_" . group::everybody()->id)); + } + public function can_allow_deny_and_reset_intent_test() { $root = ORM::factory("item", 1); $item = ORM::factory("item")->add_to_parent($root); -- cgit v1.2.3