From dc089173456c95dcec1e6184b8e6b5b2810ced52 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 16 Dec 2008 02:31:13 +0000 Subject: Fix a bug where we were not deleting the .htaccess file on access::reset() --- core/helpers/access.php | 6 +++--- core/tests/Access_Helper_Test.php | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/helpers/access.php b/core/helpers/access.php index 36ef9c5c..f40a5c7c 100644 --- a/core/helpers/access.php +++ b/core/helpers/access.php @@ -146,10 +146,10 @@ class access_Core { if ($perm_name =="view") { self::_update_access_view_cache($group, $album); if ($group->id == 1) { - if ($value) { - self::_delete_htaccess_files($album); - } else { + if ($value === self::DENY) { self::_create_htaccess_files($album); + } else { + self::_delete_htaccess_files($album); } } } else { diff --git a/core/tests/Access_Helper_Test.php b/core/tests/Access_Helper_Test.php index 4643eb1a..3141078d 100644 --- a/core/tests/Access_Helper_Test.php +++ b/core/tests/Access_Helper_Test.php @@ -275,9 +275,18 @@ class Access_Helper_Test extends Unit_Test_Case { $album = album::create($root->id, rand(), "test album"); $this->assert_false(file_exists($album->file_path() . "/.htaccess")); + access::deny(group::everybody(), "view", $album); $this->assert_true(file_exists($album->file_path() . "/.htaccess")); + access::allow(group::everybody(), "view", $album); $this->assert_false(file_exists($album->file_path() . "/.htaccess")); + + access::deny(group::everybody(), "view", $album); + $this->assert_true(file_exists($album->file_path() . "/.htaccess")); + + access::reset(group::everybody(), "view", $album); + $this->assert_false(file_exists($album->file_path() . "/.htaccess")); } + } -- cgit v1.2.3