Skip to content

Commit

Permalink
Ensure both node() and afterSave() use ->name
Browse files Browse the repository at this point in the history
Fixes #1564
  • Loading branch information
ceeram authored and markstory committed Mar 1, 2011
1 parent b80955c commit e9011ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cake/libs/model/behaviors/acl.php
Expand Up @@ -96,7 +96,7 @@ function afterSave(&$model, $created) {
} }
$data = array( $data = array(
'parent_id' => isset($parent[0][$type]['id']) ? $parent[0][$type]['id'] : null, 'parent_id' => isset($parent[0][$type]['id']) ? $parent[0][$type]['id'] : null,
'model' => $model->alias, 'model' => $model->name,
'foreign_key' => $model->id 'foreign_key' => $model->id
); );
if (!$created) { if (!$created) {
Expand Down

3 comments on commit e9011ba

@dereuromark
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not alias in this context?

@AD7six
Copy link
Member

@AD7six AD7six commented on e9011ba Mar 1, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see. thank you

Please sign in to comment.