ER: [Zope] Obtaining the name of the authenticated user from withina product's source code

Stefan H. Holek stefan@epy.co.at
Fri, 21 Feb 2003 13:00:05 +0100


[re-added zope@zope.org]

Please keep it on the list, Igor.

I guess we need more details on your code then. There is a known issue with 
authentication information not being available before the end of traversal.

See e.g. here
<http://mail.zope.org/pipermail/zope-dev/2002-September/017596.html>

Stefan


--On Freitag, 21. Februar 2003 11:58 +0100 Igor Leturia <IGOR@emun.com> 
wrote:

>> You should not rely on AUTHENTICATED_USER.
>>> From DTML use _.SecurityGetUser().getUserName()
>>> From your Python product use
>>
>>	from AccessControl import getSecurityManager
>>
>>	user = getSecurityManager().getUser()
>>        name = user.getUserName()
>
> I've tried, but the name I obtain is 'Anonymous user', which is not
> true, there is a user authenticated. As I said, if I try
> REQUEST['AUTHENTICATED_USER'] in a DTMLMethod it is there, but not in
> the product's source code.

--
Those who write software only for pay should go hurt some other field.
/Erik Naggum/