how can my product get the username of the user accessing it? I read on the Zope API page that there is an AuthenticatedUser class with a getUserName method that should do what I want, but I don't know how to use it. -- __________________________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup
dtml:: <dtml-var "REQUEST.AUTHENTICATED_USER.getUserName()"> zpt:: <span tal:replace="structure python:request.AUTHENTICATED_USER.getUserName()"/> script:: request = context.REQUEST print request.AUTHENTICATED_USER.getUserName() return printed
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Matt Ficken Sent: Sunday, May 25, 2003 1:22 PM To: zope@zope.org Subject: [Zope] get current username
how can my product get the username of the user accessing it? I read on the Zope API page that there is an AuthenticatedUser class with a getUserName method that should do what I want, but I don't know how to use it.
-- __________________________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
DTML - <dtml-var "AUTHENTICATED_USER.getUserName()"> - will display the user name Python - AUTHENTICATED_USER.getUserName() - you need to declare AUTHENTICATED_USER as a Parameter ZPT - <p tal:content="user/getUserName"> - will display the user name Hth, Jamie -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org] On Behalf Of Matt Ficken Sent: Sunday, May 25, 2003 2:22 PM To: zope@zope.org Subject: [Zope] get current username how can my product get the username of the user accessing it? I read on the Zope API page that there is an AuthenticatedUser class with a getUserName method that should do what I want, but I don't know how to use it. -- __________________________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.481 / Virus Database: 277 - Release Date: 5/13/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.481 / Virus Database: 277 - Release Date: 5/13/2003
Matt Ficken wrote at 2003-5-25 13:22 -0500:
how can my product get the username of the user accessing it?
Others told you how to do it in DTML, ZPT. In Python Scripts and external Python code, there is unfortunately a different way: from AccessControl import getSecurityManager .... sm= getSecurityManager() # the current security manager sm.getUser() # the current user ... Dieter
participants (5)
-
Dieter Maurer -
Jamie White -
Jeff Peterson -
Matt Ficken -
Max M