I have been working on something similar for some time now, and so far
I haven't encountered any problems. I have a single web2py app and a
single PostgreSQL database. In db.py I defined a 'company' table and
added a company_id field to all the other tables (writable and
readable set to False). (Because I ran into trouble extending
functionality, I have planned to alter the data model in a next
iteration. Define a 'party' table and change all the company_id
references to party_id and add a 'organisation' table and 'people'
table.)

In the web2py app I have, amongst others, a user cms and an admin cms
controller. The user cms completely depends on the company_id field I
added to the auth_user table. I my case I have five groups: root,
plan1, plan2, plan3 and plan4, where the plans are packages of
functions. I coded a custom registration function, in which I link
users to groups in the auth_membership table. The admin cms can be
accessed by users with root membership. They retrieve the company of
which they want to administer the data and the company_id is set in
session.company_id.

I hope this gives you an idea of one possible solution.


Kind regards,

Annet.

Reply via email to