Thanks - that was only a typo in the example though... I just worked out my
stupid error, I needed to use:

auth.has_membership(user_id=1, role="Super admin")

maybe too many pints on St. Patrick's day yesterday ;-)


On 18 March 2011 18:17, Massimo Di Pierro <massimo.dipie...@gmail.com>wrote:

> "Super Admin" != "Super admin"
>
> On Mar 18, 11:51 am, Tom Atkins <minkto...@gmail.com> wrote:
> > Given a user ID with ID of 1
> > and a group with ID of 1 and role = "Super Admin"
> > and an entry in auth_membership to tie the two together so that user 1 is
> a
> > member of group 1 I can do:
> >
> > >>>> auth.has_membership(1,1)
> >
> > True
> >
> > but if I do:
> >
> > >>>> auth.has_membership(1, role="Super admin")
> >
> > False
> >
> > (I'm running latest trunk)
> > Am I being stupid here? I'm following the syntax as described in the
> book:
> >
> > """
> > auth.has_membership(group_id, user_id, role)
> >
> > checks whether user_id has membership of the group group_id or the group
> > with the specified role. Only group_id or role should be passed to the
> > function, not both. If the user_id is not specified, then web2py assumes
> the
> > current logged-in user.
> > """
>

Reply via email to