Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote branch 'origin/1.2' into 1.2

  • Loading branch information...
commit df544f2dbd0a6a5df6542d1889281930e88693b8 2 parents 5f3f662 + 39a4566
@predominant predominant authored
View
3  cake/libs/model/db_acl.php
@@ -111,7 +111,8 @@ function node($ref = null) {
'conditions' => array(
$db->name("{$type}{$i}.lft") . ' > ' . $db->name("{$type}{$j}.lft"),
$db->name("{$type}{$i}.rght") . ' < ' . $db->name("{$type}{$j}.rght"),
- $db->name("{$type}{$i}.alias") . ' = ' . $db->value($alias, 'string')
+ $db->name("{$type}{$i}.alias") . ' = ' . $db->value($alias, 'string'),
+ $db->name("{$type}{$j}.id") . ' = ' . $db->name("{$type}{$i}.parent_id")
)
);
View
16 cake/tests/cases/libs/model/db_acl.test.php
@@ -260,7 +260,7 @@ function setUp() {
* @return void
*/
function testNode() {
- $Aco = new DbAcoTest();
+ $Aco =& new DbAcoTest();
$result = Set::extract($Aco->node('Controller1'), '{n}.DbAcoTest.id');
$expected = array(2, 1);
$this->assertEqual($result, $expected);
@@ -294,7 +294,19 @@ function testNode() {
$result = $Aco->node('');
$this->assertEqual($result, null);
}
- /**
+
+/**
+ * test that node() doesn't dig deeper than it should.
+ *
+ * @return void
+ */
+ function testNodeWithDuplicatePathSegments() {
+ $Aco =& new DbAcoTest();
+ $nodes = $Aco->node('ROOT/Users');
+ $this->assertEqual($nodes[0]['DbAcoTest']['parent_id'], 1, 'Parent id does not point at ROOT. %s');
+ }
+
+/**
* testNodeArrayFind method
*
* @access public
View
22 cake/tests/fixtures/aco_fixture.php
@@ -1,5 +1,4 @@
<?php
-/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@@ -59,15 +58,18 @@ class AcoFixture extends CakeTestFixture {
* @access public
*/
var $records = array(
- array('parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT', 'lft' => 1, 'rght' => 18),
- array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Controller1', 'lft' => 2, 'rght' => 9),
- array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'action1', 'lft' => 3, 'rght' => 6),
- array('parent_id' => 3, 'model' => null, 'foreign_key' => null, 'alias' => 'record1', 'lft' => 4, 'rght' => 5),
- array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'action2', 'lft' => 7, 'rght' => 8),
- array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Controller2', 'lft' => 10, 'rght' => 17),
- array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'action1', 'lft' => 11, 'rght' => 14),
- array('parent_id' => 7, 'model' => null, 'foreign_key' => null, 'alias' => 'record1', 'lft' => 12, 'rght' => 13),
- array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'action2', 'lft' => 15, 'rght' => 16),
+ array('parent_id' => null, 'model' => null, 'foreign_key' => null, 'alias' => 'ROOT', 'lft' => 1, 'rght' => 24),
+ array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Controller1', 'lft' => 2, 'rght' => 9),
+ array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'action1', 'lft' => 3, 'rght' => 6),
+ array('parent_id' => 3, 'model' => null, 'foreign_key' => null, 'alias' => 'record1', 'lft' => 4, 'rght' => 5),
+ array('parent_id' => 2, 'model' => null, 'foreign_key' => null, 'alias' => 'action2', 'lft' => 7, 'rght' => 8),
+ array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Controller2','lft' => 10, 'rght' => 17),
+ array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'action1', 'lft' => 11, 'rght' => 14),
+ array('parent_id' => 7, 'model' => null, 'foreign_key' => null, 'alias' => 'record1', 'lft' => 12, 'rght' => 13),
+ array('parent_id' => 6, 'model' => null, 'foreign_key' => null, 'alias' => 'action2', 'lft' => 15, 'rght' => 16),
+ array('parent_id' => 1, 'model' => null, 'foreign_key' => null, 'alias' => 'Users', 'lft' => 18, 'rght' => 23),
+ array('parent_id' => 9, 'model' => null, 'foreign_key' => null, 'alias' => 'Users', 'lft' => 19, 'rght' => 22),
+ array('parent_id' => 10, 'model' => null, 'foreign_key' => null, 'alias' => 'view', 'lft' => 20, 'rght' => 21),
);
}
Please sign in to comment.
Something went wrong with that request. Please try again.