Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
replaced use of model->alias by model->name, where these might cause …
…issues, refers #346
  • Loading branch information
ceeram committed Feb 27, 2011
1 parent f1f5864 commit dbd8199
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cake/libs/model/behaviors/acl.php
Expand Up @@ -48,10 +48,10 @@ function setup(&$model, $config = array()) {
if (is_string($config)) {
$config = array('type' => $config);
}
$this->settings[$model->alias] = array_merge(array('type' => 'controlled'), (array)$config);
$this->settings[$model->alias]['type'] = strtolower($this->settings[$model->alias]['type']);
$this->settings[$model->name] = array_merge(array('type' => 'controlled'), (array)$config);
$this->settings[$model->name]['type'] = strtolower($this->settings[$model->name]['type']);

$types = $this->__typeMaps[$this->settings[$model->alias]['type']];
$types = $this->__typeMaps[$this->settings[$model->name]['type']];
if (!class_exists('AclNode')) {
require LIBS . 'model' . DS . 'db_acl.php';
}
Expand Down Expand Up @@ -81,14 +81,14 @@ function setup(&$model, $config = array()) {
*/
function node(&$model, $ref = null, $type = null) {
if (empty($type)) {
$type = $this->__typeMaps[$this->settings[$model->alias]['type']];
$type = $this->__typeMaps[$this->settings[$model->name]['type']];
if (is_array($type)) {
trigger_error(__('AclBehavior is setup with more then one type, please specify type parameter for node()', true), E_USER_WARNING);
return null;
}
}
if (empty($ref)) {
$ref = array('model' => $model->alias, 'foreign_key' => $model->id);
$ref = array('model' => $model->name, 'foreign_key' => $model->id);
}
return $model->{$type}->node($ref);
}
Expand All @@ -101,7 +101,7 @@ function node(&$model, $ref = null, $type = null) {
* @access public
*/
function afterSave(&$model, $created) {
$types = $this->__typeMaps[$this->settings[$model->alias]['type']];
$types = $this->__typeMaps[$this->settings[$model->name]['type']];
if (!is_array($types)) {
$types = array($types);
}
Expand Down Expand Up @@ -131,7 +131,7 @@ function afterSave(&$model, $created) {
* @access public
*/
function afterDelete(&$model) {
$types = $this->__typeMaps[$this->settings[$model->alias]['type']];
$types = $this->__typeMaps[$this->settings[$model->name]['type']];
if (!is_array($types)) {
$types = array($types);
}
Expand Down

0 comments on commit dbd8199

Please sign in to comment.