crud does what it does enforce permission on table... I think you need to create group, membership to this group to one of your user (your user for instance), then create permissions : create permission for table x for group y. You can use the appadmin interface for that at /appname/appadmin
Also,* *I don't understand why you pass to form "crud()" in your return of "create_contacts()". I think it a mistake it should be "return dict(form=form)" Hope it helps. Richard On Thu, Aug 1, 2013 at 12:55 PM, GregD <[email protected]> wrote: > I've turned on auth and attempting to use crud. > > when I go to my app http://.../data/create/table_name > > I get "insufficient privileges" > NOT Authorized > Access Denied > > What am I missing? > > db.py is as follows: > > from gluon.tools import Auth > from gluon.tools import Crud > > db = DAL('sqlite://storage.sqlite') > > db.define_table ( > 'contacts', > Field('FirstName'), > Field('LastName', requires=IS_NOT_EMPTY()), > Field('Address1'), > Field('Address2'), > Field('City'), > Field('State'), > Field('Zip'), > Field('Mobile'), > Field('Work'), > Field('Fax'), > Field('Home'), > Field('EmailAddr'), > Field('WebURL'), > Field('JobTitle'), > Field('Company'), > Field('CreateDate', 'datetime', default=request.now, writable=False) ) > > auth = Auth(db) > auth.define_tables(username=True) > > crud = Crud(db) > crud.settings.auth = auth > crud.settings.controller = 'default' > crud.settings.create_next = URL('index') > > default.py <controller> includes the following: > > def give_create_permission(form): > group_id = auth.id_group('user_%s' % auth.user.id) > auth.add_permission(group_id, 'read', db.contacts) > auth.add_permission(group_id, 'create', db.contacts) > auth.add_permission(group_id, 'select', db.contacts) > > crud.settings.auth = auth > > def create_contacts(): > form = crud.create(db.contacts, onaccept=give_update_permission) > return dict(form=crud()) > > -- > > --- > 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/groups/opt_out. > > > -- --- 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/groups/opt_out.

