[Grok-dev] How to get current principal in an Utility?

Christian Klinger cklinger at novareto.de
Mon Nov 8 10:31:11 EST 2010


Am 08.11.10 16:22, schrieb Shrek Zhou:
>
> I need to access current logged in principal in an Utility, how to do that?
> :-(

Hey Shrek

you can try this:

import zope.security
principal=zope.security.management.getInteraction().participations[0].principal


But i don't know if it's the clear way todo it?

Christian



More information about the Grok-dev mailing list