You sound as if you probably have more cakephp experience than myself,
so feel free to disregard this, but you could perhaps make use of
access control lists and authentication here.

I have no experience of setting this up, but I'm assuming that all
companies/employees will access a fairly generic system, so you could
first of all setup that system, then setup the groups and users,
whereby logged in users are only allowed to view things related to
their group (company). I think the built in cakephp stuff could handle
this although I only messed around with it briefly.

It is like a user only being able to edit their post on a forum,
except you would take that further and only allow a user to view/
retrieve their posts and group posts.

On May 28, 11:02 pm, modethirteen <modethirt...@gmail.com> wrote:
> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to