mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing incorrect selection of parent nodes in ACL, fixes #4324
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6653 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
017c07c7bf
commit
c7677c2a5e
2 changed files with 12 additions and 0 deletions
|
@ -128,6 +128,15 @@ class AclNode extends AppModel {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$result = $db->read($this, $queryData, -1);
|
$result = $db->read($this, $queryData, -1);
|
||||||
|
$path = array_values($path);
|
||||||
|
|
||||||
|
if (
|
||||||
|
!isset($result[0][$type]) ||
|
||||||
|
(!empty($path) && $result[0][$type]['alias'] != $path[count($path) - 1]) ||
|
||||||
|
(empty($path) && $result[0][$type]['alias'] != $start)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} elseif (is_object($ref) && is_a($ref, 'Model')) {
|
} elseif (is_object($ref) && is_a($ref, 'Model')) {
|
||||||
$ref = array('model' => $ref->alias, 'foreign_key' => $ref->id);
|
$ref = array('model' => $ref->alias, 'foreign_key' => $ref->id);
|
||||||
} elseif (is_array($ref) && !(isset($ref['model']) && isset($ref['foreign_key']))) {
|
} elseif (is_array($ref) && !(isset($ref['model']) && isset($ref['foreign_key']))) {
|
||||||
|
|
|
@ -174,6 +174,9 @@ class AclComponentTest extends CakeTestCase {
|
||||||
|
|
||||||
$this->assertFalse($this->Acl->check('Manager', 'Reports', 'create'));
|
$this->assertFalse($this->Acl->check('Manager', 'Reports', 'create'));
|
||||||
$this->assertTrue($this->Acl->check('Secretary', 'Links', 'create'));
|
$this->assertTrue($this->Acl->check('Secretary', 'Links', 'create'));
|
||||||
|
|
||||||
|
$this->expectError('DB_ACL::allow() - Invalid node');
|
||||||
|
$this->assertFalse($this->Acl->allow('Manager', 'Links/DoesNotExist', 'create'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDbAclCheck() {
|
function testDbAclCheck() {
|
||||||
|
|
Loading…
Reference in a new issue