My web app will be used by different companies. Defining roles and
permissions for the application works well for one company. With more
companies there are problems. Defining application table in db.py
seems to make the table available to all the companies. This demands
permissions defined at record levels and results in much larger
tables. (1.)(Is this the only solution?)

I had read in the docs or forums (can't find it after looking again)
that db tables are created for a user when they first authenticate -
Web2Py only creates the one instance of the table and not any specific
to the users group.  There might be a specific collections table for
role=accountants, (2)but there is no way of causing different
collection tables to be created the accountants of different
companies?

I tried in the controller:
#my_customers_name is from a Form entered by user_id to create the
"accounts" table

accounts = my_customers_name + '_collections_' + str(auth.user_id)
db.define_table( accounts ,
                         Field('name'))
#which created the expected accounts tables in the db folder.

# This approach falls apart here:
 db.?.insert(name='Big Company')
#If using the same variable, accounts, Web2Py thinks that is the name
of the database.
(3) Is there any way to make this last approach work, or is there any
other alternatives?

Thanks in advance for any advice or pointers to docs. I'm new to
Web2Py but progress on the app has been going great! thanks, James

Reply via email to