The point is that Session is not defined in models. So if you do like
this, you will have to do it each time you want to save a User without
the group_id field, in each of your controller's actions.

Doing it directly in the model allows you to care about the presence
of the group_id field only once. But it is done through an extra SQL
query to retrieve the group_id value. We could of course retrieve the
group_id in the model by directly using the $_SESSION variable.

By the way, I have always wondered if it was a design choice to not
have access to the CakeSession object in the model. If anyone has the
answer, I would be happy to read it.

nIcO


On 4 juin, 22:25, stefano <[email protected]> wrote:
> try with
>
> $this->data["User"]["group_id"] = $this->Session-
>
> >read("Auth.User.group_id");
>
> :)
>
> s.
>
> On May 24, 10:59 am, Jon Chin <[email protected]> wrote:
>
> > I'm using Auth and db ACL, but I have an action that screws up my ACL
> > records every time.  I have ACL set up just like the Book instructs.  I'm
> > building a "change password" page where I want to just update the password.
> >  I run the following commands:
> >  $this->User->id = $this->Session->read('Auth.User.id');
> > $this->User->saveField('password', $this->data['User']['password']);
> > (I've also tried $this->User->save()).  When I execute this, it deletes the
> > user's parent_id from the aros table as well as corrupts the tree-ness of
> > the ACL tables.  What am I doing wrong?  Thanks in advance.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected] For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to