What I need to accomplish is a single Application with a single database but multiple accounts (companies), each with multiple users.
The URL convention must be as follows: domain.com/account/controller/action
So ALL controllers are prefixed by the company/account name.
All accounts would share the single database, but each one would need to be able to restrict access to their data.
The question is, how do I implement this? I've thought about implementing some sort of htaccess rewrite where I strip out the first URL parameter (account) and pass as a query string parameter, which would be internally parsed by the app_controller. The challenge, however, is maintaining integrity with all of the links throughout the app. I.e. the cake routing would somehow need to be aware of the account parameter and pass it to all outputted links.
Has anyone accomplished something similar to this before?