On 1 June 2012 10:18, Sanjeet Roy <[email protected]> wrote:

> HIi i am useng the following codes :-
>
> def test():
>     table =
> SQLFORM.grid(db.abc,create=(auth.has_permission('CRUD','auth_user') or
> auth.has_permission('Admin','auth_user')), maxtextlength=100, selectable =
> (lambda ids: del_abc(ids) and (auth.has_permission('Admin','auth_user'))))
>     return dict(table=table)
>
> but here i am not be able to hide the selectable based on the permissions
> so i want to hide the permissions with lambda in selectable.
>

if auth.has_membership(role = 'some role'):
        grid = SQLFORM.grid(query,selectable = lambda ids: somefunction(ids)
else:
        grid = SQLFORM.grid(query)

If you don't want to do it this way but on a per-row permission, you can
make the lambda referring to a function where you handle the permissions.


Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

Reply via email to