I am a newbie to web2py and working out the examples on crud+auth. I did the following on the welcome app: - added a new table "test" with one text column "col1" - added the following code in db.py
def give_create_permission(form): group_id = auth.id_group('user_%s' % auth.user.id) auth.add_permission(group_id,'read',db.test,0) auth.add_permission(group_id, 'create',db.test,0) auth.add_permission(group_id, 'select',db.test,0) def give_update_permission(form): test_id=form.vars.id group_id = auth.id_group('user_%s' % auth.user.id) auth.add_permission(group_id,'update',db.test,0) auth.add_permission(group_id,'delete',db.test,0) auth.settings.register_onaccept=give_create_permission crud.settings.auth = auth - added the following code in the default controller: def viewrows(): form=crud.create(db.test,onaccept=give_create_permission) return dict(form=form) def editrows(): form=crud.create(db.test,onaccept=give_update_permission) tests=db(db.test).select() return dict(form=form,tests=tests) If I try to access both controller actions viewrows or editrows post login, I am getting a "Not authorized" error with a flash message "insufficient privileges" If I comment out crud.settings.auth = auth then the access works. I tried debugging but couldn't zero it down. Appreciate if anyone could help on the same. Additionally, is there any other reference material/code recipes apart from the web2py book on crud+auth? Cheers Babu --