In a cms application I defined the following auth_user table:

auth.settings.table_user = db.define_table('auth_user',
    Field('first_name',length=24,default=''),
    Field('last_name',length=42,default=''),
 
Field('company_id',db.company,default='',notnull=True,writable=False,readable=False),
    Field('email',length=72,default='',notnull=True),
 
Field('username',length=72,default='',notnull=True,unique=True,writable=False,readable=False),
 
Field('password',type='password',length=512,default='',notnull=True,readable=False),
 
Field('account',length=2,default='0',notnull=True,writable=False,readable=False),
    Field('registration_key',length=512,default='',writable=False,
readable=False),
    Field('reset_password_key',length=512,default='',writable=False,
readable=False),
    Field('registration_id',length=512,default='',writable=False,
readable=False))

Key for this csm to work is that auth.user.company_id references the
company the logged in user manages the content of. All functions
contain a line of code to set the company_id to auth.user.company_id:

def manage_address():
    ...
    db.address.company_id.default=auth.user.company_id
    ...
    return dict(...)

I read the documentation on the impersonate functionality, and I
wonder whether when I enter an impersonate permission for myself in
the auth_permission table for every registered user, does
auth.user.company_id reference my company_id or the company_id of the
user I impersonate?


Kind regards,

Annet.

Reply via email to