Hello,

I'm fairly saavy at writing cake apps at this point but I am not sure
where to start with this one. What I need to accomplish is a single
Application with a single database but multiple accounts (companies),
each with multiple users (employees).

As much as would love to put each company in its own app directory
with its own db its not an option.

All accounts would share the single database, but each one would need
to be able to restrict access to their data.
I would prefer a different point of entry/portal for each company, I
assume I would use Router to accomplish this?

/appname.com/company1/users/login
/appname.com/company2/users/login
etc.

So obviously ALL controllers are prefixed by the company name:

/appname.com/company1/reports/view
etc..

I'm not sure how I should seperate the data between different
companies

1) Multiple tables with a company name prefix (ie companyname1_people,
companyname2_people, etc.) and a dynamic table prefix based on the
User.session?

2) All companies share the same tables but each row has a unique
company_id, and based on the company name in the session, only the
data belonging to said company is accessed by users with the same
company_id.

(In other words, is better to seperate tables and potentially have
hundreds or share them and have 20 or so with thousands and thousands
of rows? Its my minimal understanding that the latter is better)

Further more, assuming everyone is sharing tables, where should the
logic to seperate this data be located? Is there a $this->params that
extracts the company name prefixing the controller (/companyname/
controller) and could that be tested against the user's company id/
name when fetching data? If so, in the model or the controller?

I tried using $this->params['prefix'] but it seemed to only prefix the
controller calls (ie. /companyname/controller =
companyname_controller)

I don't expect everyone to write this app for me, but a bit of
direction so I can at least start it correctly would we very much
appreciated.

--~--~---------~--~----~------------~-------~--~----~
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