Thursday, October 2, 2008

Re: Update problem in AclBehavior

I don' think this is going to be changed before 1.2 is released but it
is pretty easy to do in your models.

http://mark-story.com/Posts/view/auth-and-acl-automatically-updating-user-aros

tutorial for doing it with users, follows along with the sample app in
the cookbook.

-Mark

On Oct 2, 10:36 am, lightglitch <mario.ffra...@gmail.com> wrote:
> When adding a record in a Model that acts as AclBehavior everything
> works fine and a new record is created in the Aro/Aco table linked to
> the previous one.
>
> But when I update that same record and change the alias or the parent
> the Arco/Aco record is not updated.
> I have check the code and the <i>afterSave</i> method is only
> implemented for inserts and not updates:
>
> function afterSave(&$model, $created) {
> if ($created) {
> $type = $this->__typeMaps[strtolower($this->settings[$model->name]
> ['type'])];
> $parent = $model->parentNode();
> if (!empty($parent)) {
> $parent = $this->node($model, $parent);
> } else {
> $parent = null;
> }
>
> $model->{$type}->create();
> $model->{$type}->save(array(
> 'parent_id' => Set::extract($parent, "0.{$type}.id"),
> 'model' => $model->name,
> 'foreign_key' => $model->id
> ));
> }
> }
>
> There's something missing in the implementation or is suppose to be
> like that?
> Because the update would handy ...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: