I have a table named 'person' and I have given permission to all registered users create rows in this table with:
db.define_table('person', Field('name','string', required=True, label="Full Name"), Field('gender', 'string', required=True, label="Gender", default='Male', requires=IS_IN_SET(['Male','Female']))) def give_create_permission(form): group_id = auth.id_group('user_%s' % auth.user.id) auth.add_permission(group_id, 'create', db.person) auth.add_permission(group_id, 'select', db.person) auth.settings.register_onaccept = give_create_permission Now I want the users to do read, update and delete only on the rows that they created and I trying the following to achieve this: def give_person_update_permission(form): person_id = form.vars.id group_id = auth.id_group('user_%s' % auth.user.id) auth.add_permission(group_id, 'read', db.person, person_id) auth.add_permission(group_id, 'update', db.person, person_id) auth.add_permission(group_id, 'delete', db.person, person_id) auth.add_permission(group_id, 'select', db.person) crud.settings.create_onvalidation.person.append(lambda form: give_person_update_permission(form)) crud.settings.create_oncreate.person.append(lambda form: give_person_update_permission(form)) But this doesnt seem to be working. And SQLFORM.grid is not showing any rows for person. I check the auth_permission and this is what it has to show: sqlite> select * from auth_permission; 1|1|create|person|0 2|1|select|person|0 Can someone please help how to achieve this? Thanks, -Saif. -- --- 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.