summaryrefslogtreecommitdiff
path: root/core/tests
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-12-31 00:18:24 +0000
committerBharat Mediratta <bharat@menalto.com>2008-12-31 00:18:24 +0000
commitad719b9b6f3391da1ba7e481890317cdc409c616 (patch)
treed809173b1dbdd3cf4e05a9bc5984d3aa4c0398f3 /core/tests
parentcbbbc23c2f5f1f4b5325f1a25251e419b512733f (diff)
Fully implement the view_full permission.
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/Access_Helper_Test.php28
1 files changed, 28 insertions, 0 deletions
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"));
+ }
}