diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-12-08 10:46:53 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-08 10:46:53 +0000 |
commit | bd3a472be7979aadb730f7ac6caaa3c47a6ce11c (patch) | |
tree | 41946e5e3cc46ee12604ff1245e51e01d55df8d5 | |
parent | 85239ec75034fb9ad0f3c2d26d77d760a4e6dfd7 (diff) |
Rename access::can() to access::group_can()
-rw-r--r-- | core/helpers/access.php | 4 | ||||
-rw-r--r-- | core/tests/Access_Helper_Test.php | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/core/helpers/access.php b/core/helpers/access.php index 4c623f7c..369e1897 100644 --- a/core/helpers/access.php +++ b/core/helpers/access.php @@ -71,14 +71,14 @@ class access_Core { const UNKNOWN = 2; /** - * Can this group have this permission on this item? + * Does this group have this permission on this item? * * @param integer $group_id * @param string $perm_name * @param integer $item_id * @return boolean */ - public static function can($group_id, $perm_name, $item_id) { + public static function group_can($group_id, $perm_name, $item_id) { $access = ORM::factory("access_cache")->where("item_id", $item_id)->find(); if (!$access) { throw new Exception("@todo MISSING_ACCESS for $item_id"); diff --git a/core/tests/Access_Helper_Test.php b/core/tests/Access_Helper_Test.php index 78948beb..ead3c3a5 100644 --- a/core/tests/Access_Helper_Test.php +++ b/core/tests/Access_Helper_Test.php @@ -114,7 +114,7 @@ class Access_Helper_Test extends Unit_Test_Case { public function can_view_item_test() { $root = ORM::factory("item", 1); access::allow(0, "view", $root->id); - $this->assert_true(access::can(0, "view", $root->id)); + $this->assert_true(access::group_can(0, "view", $root->id)); } public function cant_view_child_of_hidden_parent_test() { @@ -124,7 +124,7 @@ class Access_Helper_Test extends Unit_Test_Case { access::deny(0, "view", $root->id); access::reset(0, "view", $album->id); - $this->assert_false(access::can(0, "view", $album->id)); + $this->assert_false(access::group_can(0, "view", $album->id)); } public function view_permissions_propagate_down_test() { @@ -134,7 +134,7 @@ class Access_Helper_Test extends Unit_Test_Case { access::allow(0, "view", $root->id); access::reset(0, "view", $album->id); - $this->assert_true(access::can(0, "view", $album->id)); + $this->assert_true(access::group_can(0, "view", $album->id)); } public function can_toggle_view_permissions_propagate_down_test() { @@ -164,10 +164,10 @@ class Access_Helper_Test extends Unit_Test_Case { access::reset(0, "view", $album2->id); access::reset(0, "view", $album3->id); access::reset(0, "view", $album4->id); - $this->assert_false(access::can(0, "view", $album4->id)); + $this->assert_false(access::group_can(0, "view", $album4->id)); access::allow(0, "view", $album1->id); - $this->assert_true(access::can(0, "view", $album4->id)); + $this->assert_true(access::group_can(0, "view", $album4->id)); } public function revoked_view_permissions_cant_be_allowed_lower_down_test() { @@ -177,13 +177,13 @@ class Access_Helper_Test extends Unit_Test_Case { access::deny(0, "view", $root->id); access::allow(0, "view", $album->id); - $this->assert_false(access::can(0, "view", $album->id)); + $this->assert_false(access::group_can(0, "view", $album->id)); } public function can_edit_item_test() { $root = ORM::factory("item", 1); access::allow(0, "edit", $root->id); - $this->assert_true(access::can(0, "edit", $root->id)); + $this->assert_true(access::group_can(0, "edit", $root->id)); } public function non_view_permissions_propagate_down_test() { @@ -193,7 +193,7 @@ class Access_Helper_Test extends Unit_Test_Case { access::allow(0, "edit", $root->id); access::reset(0, "edit", $album->id); - $this->assert_true(access::can(0, "edit", $album->id)); + $this->assert_true(access::group_can(0, "edit", $album->id)); } public function non_view_permissions_can_be_revoked_lower_down_test() { @@ -218,7 +218,7 @@ class Access_Helper_Test extends Unit_Test_Case { access::allow(0, "edit", $inner->id); // Outer album is not editable, inner one is. - $this->assert_false(access::can(0, "edit", $outer_photo->id)); - $this->assert_true(access::can(0, "edit", $inner_photo->id)); + $this->assert_false(access::group_can(0, "edit", $outer_photo->id)); + $this->assert_true(access::group_can(0, "edit", $inner_photo->id)); } } |