[Zope] How to get the name of the authenticated user when writing cmf types ?

Jim Washington jwashin@vt.edu
Thu, 02 Jan 2003 08:00:34 -0500


Low Kian Seong wrote:

>Dear People,
>
>I am coding a cmftype to be used together with Plone.
>My question is why can i get the user using :
>
>self.REQUEST['AUTHENTICATED_USER'].getUserName() 
>
>but when i try :
>
>AccessControl.SecurityManager.getUserName() 
>
>it gives me an error saying that type 'module' is
>uncallable ?
>
>Any help or explanation is appreciated. Thank you.
>  
>
You want to query a SecurityManager instance, not a reference to the 
module itself.

from AccessControl import getSecurityManager
securityManager = getSecurityManager()
user = securityManager.getUser()
userName = user.getUserName()

-- Jim Washington