mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-28 04:32:57 +00:00
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7072 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
14df77c12d
commit
c57b5611a0
2 changed files with 34 additions and 15 deletions
cake
|
@ -393,6 +393,7 @@ class DbAcl extends AclBase {
|
|||
$save['id'] = $perms['link'][0][$this->Aro->Permission->alias]['id'];
|
||||
} else {
|
||||
unset($save['id']);
|
||||
$this->Aro->Permission->id = null;
|
||||
}
|
||||
return ($this->Aro->Permission->save($save) !== false);
|
||||
}
|
||||
|
|
|
@ -130,11 +130,29 @@ class AclComponentTest extends CakeTestCase {
|
|||
$this->assertTrue($this->Acl->check('Micheal', 'tpsReports', 'read'));
|
||||
$this->assertTrue($this->Acl->check('Micheal', 'tpsReports', 'delete'));
|
||||
|
||||
$this->assertFalse($this->Acl->check('Micheal', 'tpsReports', 'create'));
|
||||
$this->assertTrue($this->Acl->allow('Micheal', 'ROOT/tpsReports', 'create'));
|
||||
$this->assertTrue($this->Acl->check('Micheal', 'tpsReports', 'create'));
|
||||
$this->assertTrue($this->Acl->check('Micheal', 'tpsReports', 'delete'));
|
||||
$this->assertTrue($this->Acl->allow('Micheal', 'printers', 'create'));
|
||||
// Michael no longer has his delete permission for tpsReports!
|
||||
$this->assertTrue($this->Acl->check('Micheal', 'tpsReports', 'delete'));
|
||||
$this->assertTrue($this->Acl->check('Micheal', 'printers', 'create'));
|
||||
|
||||
|
||||
$this->assertFalse($this->Acl->check('root/users/Samir', 'ROOT/tpsReports/view'));
|
||||
$this->assertTrue($this->Acl->allow('root/users/Samir', 'ROOT/tpsReports/view', '*'));
|
||||
$this->assertTrue($this->Acl->check('Samir', 'view', 'read'));
|
||||
$this->assertTrue($this->Acl->check('root/users/Samir', 'ROOT/tpsReports/view', 'update'));
|
||||
|
||||
|
||||
$this->assertFalse($this->Acl->check('root/users/Samir', 'ROOT/tpsReports/update','*'));
|
||||
$this->assertTrue($this->Acl->allow('root/users/Samir', 'ROOT/tpsReports/update', '*'));
|
||||
$this->assertTrue($this->Acl->check('Samir', 'update', 'read'));
|
||||
$this->assertTrue($this->Acl->check('root/users/Samir', 'ROOT/tpsReports/update', 'update'));
|
||||
// Samir should still have his tpsReports/view permissions, but does not
|
||||
$this->assertTrue($this->Acl->check('root/users/Samir', 'ROOT/tpsReports/view', 'update'));
|
||||
|
||||
$this->expectError('DbAcl::allow() - Invalid node');
|
||||
$this->assertFalse($this->Acl->allow('Lumbergh', 'ROOT/tpsReports/DoesNotExist', 'create'));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue