mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Deprecating AclComponent::revoke() and AclComponent::grant() they were simply aliases that create a larger API with no real benefit.
This commit is contained in:
parent
62982c57b4
commit
523eda018e
2 changed files with 7 additions and 12 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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'));
|
||||
|
|
Loading…
Reference in a new issue