> It returns all the rows which are visible in view. My requirement is that
I want to make edit/delete button visible only for the user's
> whose userid is same as some predefined value "SOMEUSER", for other
userid's edit/delete button should be disabled/not visible.
> Can some one please tell me on how to do this.
You could pass the grid(deletable=bool) option retrieved from an evaluated
condition such as:
def can_delete(user_id):
# check permissions here
if <some condition>:
return True
return False
grid = SQLFORM.grid(deletable=can_delete(auth.user_id))
For restricting query results for a given user, it's possible to use a
logic like the above but using auth.accessible_query (requires a db backend
with JOIN support) for filtering the grid helper query argument.
Accessible query is documented in the book chapter "Access Control" and
.grid helper is documented in "Forms and Validators"
--
---
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.