You have two options:

1) decorate your functions with @auth.requires_login() and user_signature = 
True (default)
2) leave the functions as they are and user_signature = False (no 
protection)

You cannot have a per user signature and at same time not require a logged 
in user.



On Saturday, 25 August 2012 06:53:11 UTC-5, lyn2py wrote:
>
> I have 2 SQLFORM.grids, they are:
>
> ##MODELS
> db.define_table('company', #each staff can only see the customers under 
> their account
>     Field('company_name', 'string',length=255,requires=IS_NOT_EMPTY()),
>     Field('description','text'),
>     format='%(company_name)s'
> )
>
> db.define_table('employees', #each customer has their key contacts
>     Field('company_id','reference company',writable=False,label='Company 
> Name'), 
>     Field('first_name', 'string',length=255,requires=IS_NOT_EMPTY()),
>     Field('last_name', 'string',length=255,requires=IS_NOT_EMPTY()),
>     Field('role', 'string',length=255,requires=IS_NOT_EMPTY()),
> )
>
> ##CONTROLLER
> def company():
>     grid=SQLFORM.grid(db.company.created_by==auth.user_id,links = [lambda 
> row: A('Add Employee',,_href=URL("default","employees",args='new')))
>     return locals()
>
> def employees():
>     grid=SQLFORM.grid(db.employees.created_by==auth.user_id,links = 
> [lambda row: A('View Company 
> Details',_href=URL("default","company",args=row.company_id)))
>     return locals()
>
> The problem I have is, When I click on the LINK (either the *Add Employee*or 
> the 
> *View Company Details* links), I am told "Not Authorized".
> I assume it has to do with user_signature.
>
> How can I use SQLFORM.grid with user-defined links and still keep 
> user_signature=True?
>
> If I am using it wrongly or misinterpret its correct use, please correct 
> me.
>
> Thank you!
>

-- 



Reply via email to