That's what I've done in the past when I want to include data that Auth doesn't automatically store. IIRC, you can write to the Auth.User key; the data will then be available from the user() method.
$this->Session->write('Auth.User.group', $group_data); Retrieve with $this->Auth->user('group') On Fri, Oct 26, 2012 at 5:45 AM, Álvaro G. Vicario <alv...@demogracia.com> wrote: > I have a User model to use built-in authentication. The model has several > $hasOne relationships and all linked models get saved automatically into > session, which is great because I can call AuthComponent::user() whenever I > need to perform an action based on user data. > > Now, I've added a $hasAndBelongsToMany relationship to indicate that a user > can belong to zero or more groups. However, information about the Group > model doesn't show up anywhere in the Auth component. I can definitively > perform a manual User->find() and groups will be there but > AuthComponent::user() does not contain group information. I've tried > everything I could think of, including the contain option. I know I'm using > contain right because it makes valid models appear and it complains for > non-existant models, but Group is simply ignored. > > In the end I had to write a hack in my login function: make a manual find() > and incorporate the 'Group' key to session data. > > Is this a known limitation? > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > 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+unsubscr...@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.