You can use auth.has_membership(role='some_role') to test whether the 
logged in user has membership in a given group. You can use that to 
conditionally display the links in the view as well as to restrict access 
to the grid (i.e., redirect somewhere if access is restricted).

Anthony

On Sunday, April 1, 2012 7:53:08 PM UTC-4, CtrlSoft wrote:
>
> how to hide tables based on user membership?
>
> i have following functin in controller:
> def view():
>     table = request.args(0)
>     grid = SQLFORM.grid(db[table],args=request.args[:1], ui = 
> dict(widget='',
>           header='',
>           content='',
>           default='',
>           cornerall='',
>           cornertop='',
>           cornerbottom='',
>           button='btn',
>           buttontext='buttontext button',
>           buttonadd='icon-plus',
>           buttonback='icon-arrow-left',
>           buttonexport='icon-file',
>           buttondelete='icon-trash',
>           buttonedit='icon-edit',
>           buttontable='icon-arrow-right',
>           buttonview='icon-eye-open'))
>     return dict(item=grid)
>
> and in view:
>
>    <li><a href="{{=URL('appadmin','view', args=[db.topmenu])}}">Top 
> Menu</a></li>
>    <li><a href="{{=URL('appadmin','view', args=[db.sidemenu])}}">Side 
> Menu</a></li>
>    <li><a href="{{=URL('appadmin','view', 
> args=[db.articles])}}">Articles</a></li>
>    <li><a href="{{=URL('appadmin','view', 
> args=[db.poll])}}">Questions</a></li>
>    <li><a href="{{=URL('appadmin','view', 
> args=[db.answer])}}">Answers</a></li> 
>
> i need that a specific user can edit specific table

Reply via email to