why not use default auth user table and use editable and deletable on your 
grid?

e.g.
*db.py*
auth.settings.extra_fields['auth_user']=[
    Field('gender', 'list:string', notnull=True),
    Field('address', 'text', notnull=True),
    Field('zip', length=10, notnull=True),
    Field('city', length=10, notnull=True),
    Field('country', length=10, notnull=True),
    Field('phone', length=10, notnull=True, unique=True),
    Field('company', 'reference company', notnull=True)]

auth.define_tables(username=False, signature=True)

from gluon.contrib.populate import populate
if db(db.auth_user).isempty():

    auth.add_group('Manager', 'Manager')
    auth.add_group('Admin', 'Admin')
    
    auth.add_membership('1', '1')
    auth.add_membership('2', '1')
    auth.add_membership('2', '2')
    
    db.auth_user.bulk_insert([{'first_name' : 'Manager', 'last_name' : 
'Manager', 
                               'email' : 'mana...@test.com', 
                               'password' : 
db.auth_user.password.validate('password')[0],
                               'gender' : 'Male', 'address' : 'Address', 
'zip' : '11111',
                               'city' : 'Jakarta', 'country' : 'Indonesia', 
'phone' : '1',
                               'company' : 1}, 
                              {'first_name' : 'Admin', 'last_name' : 
'Admin', 
                               'email' : 'ad...@test.com', 
                               'password' : 
db.auth_user.password.validate('password')[0],
                               'gender' : 'Male', 'address' : 'Address', 
'zip' : '11111',
                               'city' : 'Jakarta', 'country' : 'Indonesia', 
'phone' : '2',
                               'company' : 1}])

*default.py*
@auth.requires_login()
def rent():
    has_membership=auth.has_membership('Manager')
    grid=SQLFORM.grid(db.person, user_signature=False, 
                      editable=has_membership, deletable=has_membership)
    return locals()

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to