I couldn't wait for Monday. Yes, your code works !!
On Sep 23, 5:16 pm, Omi Chiba <[email protected]> wrote: > Oh I just found your post, you are too fast. > Actually, I came up the following code and confirmed it works !! but > yours looks more simple so I will try next Monday. > > Thank you ! > > response.menu = [('Public', True, URL('index')), > ('Member Only', False, URL('member')) > ] > > if auth.user: > groups = db((db.auth_membership.user_id==auth.user.id)& \ > (db.auth_membership.group_id==db.auth_group.id)) \ > .select(db.auth_group.role) > > for group in groups: > if group.role =='vip': > response.menu.append(('VIP Only', False, URL('vip'))) > > On Sep 23, 3:02 pm, juanduke <[email protected]> wrote: > > > > > > > > > Hi Omi: > > > I think this should work: > > > put this in models/menu.py > > > response.menu = [ > > ('Public', True, URL('index')), > > ('Member Only', False, URL('member')), > > ] > > if (auth.user_id != None) and ((auth.has_membership(role = 'vip')) : > > response.menu += [('VIP Only', False, URL('vip')), ] > > > NOT TESTED, but i think could help. > > > Bye.

