Permalink
Browse files

Ensure both node() and afterSave() use ->name

Fixes #1564
  • Loading branch information...
1 parent b80955c commit e9011badb59ffbfba75d90dcce53935785c6c8aa @ceeram ceeram committed with markstory Feb 28, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 cake/libs/model/behaviors/acl.php
View
2 cake/libs/model/behaviors/acl.php
@@ -96,7 +96,7 @@ function afterSave(&$model, $created) {
}
$data = array(
'parent_id' => isset($parent[0][$type]['id']) ? $parent[0][$type]['id'] : null,
- 'model' => $model->alias,
+ 'model' => $model->name,
'foreign_key' => $model->id
);
if (!$created) {

3 comments on commit e9011ba

@dereuromark
CakePHP member

why not alias in this context?

@AD7six
CakePHP member

name would be, for example "User" - always. 'Structural' behaviors should always reference the name, not alias property.

You could be referencing the user model as "Author" "Commenter" "Creator" etc. and as such the alias is a variable, and if used in the acl logic it would cause unexpected results (duplicate acl data with the wrong alias, not finding permissions etc.)

@dereuromark
CakePHP member

i see. thank you

Please sign in to comment.