Hi,
I don't know what your app does but here are some thoughts on your
situation.
I think you might want to think about creating a common User model.
Your existing Client and Agent models could be linked to a User via
hasOne or belongsTo.
Any common properties can be moved into User along with authentication
stuff.
You would in this case need to watch out for a User that is both
Client and Agent... you may want to prevent that in your models.

You could also take it one step further and see Client and Agent as
roles with the possibility to extent the app to handle further roles.

You could probably get away with setting userModel based on the
current url but that could cause problems when two users (a Client and
an Agent) could have the same name and password...

Just some quick thoughts.
/Martin


On Oct 16, 7:59 am, WildFox <[EMAIL PROTECTED]> wrote:
> What is the best way to handle Auth for users that belong to
> completely seperate models/tables?
>
> I have an Agent model & Client model, basically the Agent hasMany
> Client and Client belongsTo Agent - The fields for each respective
> model are radically different enough that they did indeed require
> there own models.
>
> Using CakePHP Auth component I know how and currently have Auth setup
> for the Client model, but I dont know how to set it up to have the
> Auth component also Handle the Agent model.
>
> Is this a situation where the Auth component may not be the best
> choice?
>
> My current Auth code in my AppController beforeFilter() is....
>
> $this->Auth->userModel = 'Client';
> $this->Auth->fields = array('username' => 'email', 'password' =>
> 'password');
> $this->Auth->loginAction = array('controller' => 'account', 'action'
> => 'login');
> $this->Auth->loginRedirect = array('/');
> $this->Auth->authorize = 'controller';
> $this->Auth->deny("*");
> $this->Auth->logoutRedirect = array('controller' => 'account',
> 'action' => 'login');
>
> As an aside... When I login, it takes me back to the Login page even
> on success, is there something up there that is foobaring the
> redirect?
>
> Also, whats the best way to handle possibly putting the Agent route/
> pages on a subdomain so I would potentially end up with....
>
> http://mydomain.com- Client areahttp://agent.mydomain.com- Agent area (/agent 
> - Route)
>
> Thanks all
--~--~---------~--~----~------------~-------~--~----~
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