another way around, use the group and membership (assign the user into 
admin membership)
e.g.
# group
auth.add_group('Admin', 'Admin')
auth.add_group('User', 'User')

# user
db.auth_user.bulk_insert([{'first_name' : 'Admin', 'last_name' : 'Admin', 
                           'email' : '[email protected]', 'username' : 'Admin', 
                           'password' : 
db.auth_user.password.validate('password')[0] }, 
                          {'first_name' : 'User', 'last_name' : 'User', 
                           'email' : '[email protected]', 'username' : 'User', 
                           'password' : 
db.auth_user.password.validate('password')[0] } ] )

# membership (group_id, user_id)
auth.add_membership('1', '1')
auth.add_membership('2', '1')
auth.add_membership('2', '2')

# admin in controller
has_membership_admin = auth.has_membership('Admin')

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to