From ad719b9b6f3391da1ba7e481890317cdc409c616 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 31 Dec 2008 00:18:24 +0000 Subject: Fully implement the view_full permission. --- core/tests/Access_Helper_Test.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'core/tests/Access_Helper_Test.php') diff --git a/core/tests/Access_Helper_Test.php b/core/tests/Access_Helper_Test.php index 6177723b..aaf919b1 100644 --- a/core/tests/Access_Helper_Test.php +++ b/core/tests/Access_Helper_Test.php @@ -289,4 +289,32 @@ class Access_Helper_Test extends Unit_Test_Case { $this->assert_false(file_exists($album->file_path() . "/.htaccess")); } + public function everybody_view_full_permission_maintains_htaccess_files_test() { + $root = ORM::factory("item", 1); + $album = album::create($root, rand(), "test album"); + + $this->assert_false(file_exists($album->file_path() . "/.htaccess")); + $this->assert_false(file_exists($album->resize_path() . "/.htaccess")); + $this->assert_false(file_exists($album->thumb_path() . "/.htaccess")); + + access::deny(group::everybody(), "view_full", $album); + $this->assert_true(file_exists($album->file_path() . "/.htaccess")); + $this->assert_false(file_exists($album->resize_path() . "/.htaccess")); + $this->assert_false(file_exists($album->thumb_path() . "/.htaccess")); + + access::allow(group::everybody(), "view_full", $album); + $this->assert_false(file_exists($album->file_path() . "/.htaccess")); + $this->assert_false(file_exists($album->resize_path() . "/.htaccess")); + $this->assert_false(file_exists($album->thumb_path() . "/.htaccess")); + + access::deny(group::everybody(), "view_full", $album); + $this->assert_true(file_exists($album->file_path() . "/.htaccess")); + $this->assert_false(file_exists($album->resize_path() . "/.htaccess")); + $this->assert_false(file_exists($album->thumb_path() . "/.htaccess")); + + access::reset(group::everybody(), "view_full", $album); + $this->assert_false(file_exists($album->file_path() . "/.htaccess")); + $this->assert_false(file_exists($album->resize_path() . "/.htaccess")); + $this->assert_false(file_exists($album->thumb_path() . "/.htaccess")); + } } -- cgit v1.2.3