Maybe the best bet (if you keep this schema, which may not be optimal) would be to change group_id to foreign_key and add another column named model. If each of these other tables has its own model, that is.
Then, you could either just save User.model & User.foreign_key to the session, or you could fetch the data right away and save that. On Tue, Apr 7, 2009 at 10:27 PM, Dave Maharaj :: WidePixels.com <[email protected]> wrote: > > I took a look at the article and want to implement something similar along > the same idea. My problem is how can I get info from an associated table > depending on the group_id of the user logging in? > > My site the user has 1 role but each role has a different table associated > with it. So user with group_id 1 has their info stored in 1 table while > group_id 2 is in another table. How would I select the table by group_id? > Use a case/switch type setup on the Auth group_id and query the table based > on group_id? > > Thanks, > Dave > > -----Original Message----- > From: brian [mailto:[email protected]] > Sent: April-07-09 1:16 PM > To: [email protected] > Subject: Re: Selecting fields saved to Session by Auth > > > You can do this if you write your own login() method. Have a look at this > Bakery article: > > http://bakery.cakephp.org/articles/view/simple-form-authentication-in-1-2-x- > x > > > 2009/4/7 Faza <[email protected]>: >> >> Hello! >> >> I've noticed, that by default, Auth loads and saves to Session every >> field from the users model, except the field designated as the one >> with password. >> In my case, the user model contains fields which I don't want to be >> stored in session. >> >> I've read the AuthComponent API, but so far it is a bit over the top >> for me, so I need your help guys. >> >> Also, is it possible to make Auth (or ACL?? dunno) component to load >> also users group from, say, 'groups' model with a proper relation? >> That'd help a lot :) >> >> >> Cheers, >> Jacek >> >> > >> > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
