Merging fixes to trunk

Revision: [1831]
*Finally* fixing ACL.... again.  Are you all happy now?!?

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1832 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-01-18 05:35:14 +00:00
parent 3984795205
commit 35f20cb06e
5 changed files with 10 additions and 19 deletions

View file

@ -6,4 +6,4 @@
// +---------------------------------------------------------------------------------------------------+ // // +---------------------------------------------------------------------------------------------------+ //
/////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////
0.10.6.1830 RC 2 0.10.6.1832 RC 2

View file

@ -80,7 +80,7 @@ class DB_ACL extends AclBase
$tmpAcoPath = $Aco->getPath($aco); $tmpAcoPath = $Aco->getPath($aco);
$acoPath = array(); $acoPath = array();
if($action != '*' && !in_array($permKeys, '_' . $action)) if($action != '*' && !in_array('_' . $action, $permKeys))
{ {
trigger_error('ACO permissions key "' . $action . '" does not exist in DB_ACL::check()', E_USER_ERROR); trigger_error('ACO permissions key "' . $action . '" does not exist in DB_ACL::check()', E_USER_ERROR);
} }

View file

@ -28,10 +28,6 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/**
* Short description.
*/
require_once(CAKE . 'app_model.php');
/** /**
* Short description for file. * Short description for file.
@ -46,20 +42,14 @@ require_once(CAKE . 'app_model.php');
class AclNode extends AppModel class AclNode extends AppModel
{ {
/**
* Enter description here...
*
* @var unknown_type
*/
var $useTable = false;
/** /**
* Enter description here... * Enter description here...
* *
*/ */
function __construct() function __construct()
{ {
$this->setSource();
parent::__construct(); parent::__construct();
$this->__setTable();
} }
/** /**
@ -225,7 +215,7 @@ class AclNode extends AppModel
{ {
return null; return null;
} }
return $this->findAll("lft <= {$item[$class]['lft']} and rght >= {$item[$class]['rght']}"); return $this->findAll("{$data_name}.lft <= {$item[$class]['lft']} and {$data_name}.rght >= {$item[$class]['rght']}");
} }
/** /**
@ -244,7 +234,7 @@ class AclNode extends AppModel
extract($this->__dataVars()); extract($this->__dataVars());
$item = $this->find($this->_resolveID($id, $secondary_id)); $item = $this->find($this->_resolveID($id, $secondary_id));
return $this->findAll("lft > {$item[$class]['lft']} and rght < {$item[$class]['rght']}"); return $this->findAll("{$data_name}.lft > {$item[$class]['lft']} and {$data_name}.rght < {$item[$class]['rght']}");
} }
/** /**
@ -271,9 +261,11 @@ class AclNode extends AppModel
*/ */
function _syncTable($table, $dir, $lft, $rght) function _syncTable($table, $dir, $lft, $rght)
{ {
pr('...Syncing...');
$shift = ($dir == 2 ? 1 : 2); $shift = ($dir == 2 ? 1 : 2);
$this->db->query("UPDATE $table SET rght = rght " . ($dir > 0 ? "+" : "-") . " {$shift} WHERE rght > " . $rght); $this->db->query("UPDATE $table SET rght = rght " . ($dir > 0 ? "+" : "-") . " {$shift} WHERE rght > " . $rght);
$this->db->query("UPDATE $table SET lft = lft " . ($dir > 0 ? "+" : "-") . " {$shift} WHERE lft > " . $lft); $this->db->query("UPDATE $table SET lft = lft " . ($dir > 0 ? "+" : "-") . " {$shift} WHERE lft > " . $lft);
pr('...Done Syncing...');
} }
/** /**
@ -296,9 +288,9 @@ class AclNode extends AppModel
* Enter description here... * Enter description here...
* *
*/ */
function __setTable() function setSource()
{ {
$this->table = strtolower(get_class($this)) . "s"; $this->table = low(get_class($this)) . "s";
} }
} }

View file

@ -46,7 +46,7 @@ class Aco extends AclNode
* *
* @var unknown_type * @var unknown_type
*/ */
var $hasMany = 'ArosAco,AcoAction'; var $hasMany = 'ArosAco';
} }

View file

@ -640,7 +640,6 @@ class DboSource extends DataSource
case 'belongsTo': case 'belongsTo':
if ($external) if ($external)
{ {
pr('external');
$conditions = $assocData['conditions']; $conditions = $assocData['conditions'];
$sql = 'SELECT * FROM '.$this->name($linkModel->table).' AS '.$this->name($alias); $sql = 'SELECT * FROM '.$this->name($linkModel->table).' AS '.$this->name($alias);