From 523eda018e91a3b6625297b3ad2a794664eb2bd4 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Fri, 23 Apr 2010 23:14:55 -0400 Subject: [PATCH] Deprecating AclComponent::revoke() and AclComponent::grant() they were simply aliases that create a larger API with no real benefit. --- cake/libs/controller/components/acl.php | 9 ++------- .../cases/libs/controller/components/acl.test.php | 10 +++++----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/cake/libs/controller/components/acl.php b/cake/libs/controller/components/acl.php index 2516ff6d3..b254e1134 100644 --- a/cake/libs/controller/components/acl.php +++ b/cake/libs/controller/components/acl.php @@ -96,13 +96,6 @@ class AclComponent extends Object { return true; } -/** - * Empty class defintion, to be overridden in subclasses. - * - */ - protected function _initACL() { - } - /** * Pass-thru function for ACL check instance. Check methods * are used to check whether or not an ARO can access an ACO @@ -164,6 +157,7 @@ class AclComponent extends Object { * @return boolean Success */ public function grant($aro, $aco, $action = "*") { + trigger_error(__('AclComponent::grant() is deprecated, use allow() instead'), E_USER_WARNING); return $this->_Instance->grant($aro, $aco, $action); } @@ -176,6 +170,7 @@ class AclComponent extends Object { * @return boolean Success */ public function revoke($aro, $aco, $action = "*") { + trigger_error(__('AclComponent::revoke() is deprecated, use deny() instead'), E_USER_WARNING); return $this->_Instance->revoke($aro, $aco, $action); } } diff --git a/cake/tests/cases/libs/controller/components/acl.test.php b/cake/tests/cases/libs/controller/components/acl.test.php index e26ed7a50..127d851fe 100644 --- a/cake/tests/cases/libs/controller/components/acl.test.php +++ b/cake/tests/cases/libs/controller/components/acl.test.php @@ -483,18 +483,18 @@ class AclComponentTest extends CakeTestCase { */ function testDbGrant() { $this->assertFalse($this->Acl->check('Samir', 'tpsReports', 'create')); - $this->Acl->grant('Samir', 'tpsReports', 'create'); + $this->Acl->allow('Samir', 'tpsReports', 'create'); $this->assertTrue($this->Acl->check('Samir', 'tpsReports', 'create')); $this->assertFalse($this->Acl->check('Micheal', 'view', 'read')); - $this->Acl->grant('Micheal', 'view', array('read', 'create', 'update')); + $this->Acl->allow('Micheal', 'view', array('read', 'create', 'update')); $this->assertTrue($this->Acl->check('Micheal', 'view', 'read')); $this->assertTrue($this->Acl->check('Micheal', 'view', 'create')); $this->assertTrue($this->Acl->check('Micheal', 'view', 'update')); $this->assertFalse($this->Acl->check('Micheal', 'view', 'delete')); $this->expectError('DbAcl::allow() - Invalid node'); - $this->assertFalse($this->Acl->grant('Peter', 'ROOT/tpsReports/DoesNotExist', 'create')); + $this->assertFalse($this->Acl->allow('Peter', 'ROOT/tpsReports/DoesNotExist', 'create')); } /** @@ -505,11 +505,11 @@ class AclComponentTest extends CakeTestCase { */ function testDbRevoke() { $this->assertTrue($this->Acl->check('Bobs', 'tpsReports', 'read')); - $this->Acl->revoke('Bobs', 'tpsReports', 'read'); + $this->Acl->deny('Bobs', 'tpsReports', 'read'); $this->assertFalse($this->Acl->check('Bobs', 'tpsReports', 'read')); $this->assertTrue($this->Acl->check('users', 'printers', 'read')); - $this->Acl->revoke('users', 'printers', 'read'); + $this->Acl->deny('users', 'printers', 'read'); $this->assertFalse($this->Acl->check('users', 'printers', 'read')); $this->assertFalse($this->Acl->check('Samir', 'printers', 'read')); $this->assertFalse($this->Acl->check('Peter', 'printers', 'read'));