On Tue, Dec 17, 2013 at 12:05 PM, Steffen Hoffmann <[email protected]> wrote:

> There must be some place in trac.admin.<some-module>, because current
> Trac >= 1.0 permission admin web-ui is grouping user groups separately.
> Just find out, how ...


I may be completely off-base, and I don't know if this is standard across
all auth / permission / group backends, but it looks like Trac's admin
web-ui uses the upper/lowercase distinction: it gets all permissions for
the given user, then distinguishes between permissions and groups by
checking whether the string starts with an uppercase letter (permission) or
a lowercase letter (group).

So I think you could get the logged-in user's groups with something like:

{{{
from trac.perm import PermissionSystem
perm = PermissionSystem(env)
perms_and_groups = perm.get_user_permissions(username=req.authname)
groups = [i for i in perms_and_groups if not i[0].isupper()]
}}}

-Ethan

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/trac-dev.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to