These kinds of problems are usually traceable to holes in the chain of 
access control tables.

How did you create your entries in the auth_group, auth_membership and 
auth_permission tables?

Does the code work correctly if you change the auth.has_permission call to 
auth.has_membership?

Look again to make sure that there is at least one group with the following 
entry in auth_permission

group_id: <some arbitrary id from auth_group>
name: edit
table_name: auth_user
records: 0 # Cannot be null!  If you created the record with a program it 
might be null.

Same for the delete permission.

Also please make sure your test user has a record in auth_membership 
linking its id to the same arbitrary id from auth_group.



On Monday, March 25, 2013 6:39:58 AM UTC-4, Sarbjit singh wrote:
>
> I did added it in grid, my controller is :
>
> @auth.requires_login()
> def rent():
>     grid=SQLFORM.grid(db.company, user_signature=False, 
>                       editable = auth.has_permission('edit','auth_user'), 
>                       deletable = 
> auth.has_permission('delete','auth_user'))
>     return locals()
>
>
> and models (db.py) are exactly same as you provided. 
>
> It is not giving any error, but all the results are non editable. Even If 
> I do login with a user 'say Manager" and add any record, it is too seen as 
> non editable whereas I want the records added by a user as editable.
>
> This line I added in my models because it seems that I haven't defined 
> permission in models. 
> auth.add_permission('edit','[email protected]', 'company', 0)
>
> I can post the complete db.py as well.
>
> Thanks
> sarbjit
>
> On Monday, March 25, 2013 3:12:03 PM UTC+5:30, 黄祥 wrote:
>>
>> did you add this in your grid?
>>     editable = auth.has_permission('edit','auth_user'), 
>>     deletable = auth.has_permission('delete','auth_user')
>>
>> i've already tested it before i posted and it works fine on me.
>>
>> in my test environment for your case i didn't add :
>>     auth.add_permission('edit','[email protected]', 'company', 0)
>>
>> is there any error?
>>
>> best regards
>>
>

-- 

--- 
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.


Reply via email to