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

Igor Leturia IGOR@emun.com
Tue, 25 Feb 2003 11:55:23 +0100


That may be the problem, as I'm trying to do it in the _init_ .

So what can I do to fix it?

		Igor

>-----Jatorrizko mezua-----
>Nondik: Stefan H. Holek [mailto:stefan@epy.co.at]
>Bidalia: Ostirala, 2003.eko otsailak 21 13:00
>Nora: Igor Leturia
>Cc: zope@zope.org
>Gaia: Re: ER: [Zope] Obtaining the name of the authenticated user
>fromwithina product's source code
>
>
>[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=20
>known issue with=20
>authentication information not being available before the end=20
>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=20
><IGOR@emun.com>=20
>wrote:
>
>>> You should not rely on AUTHENTICATED_USER.
>>>> From DTML use _.SecurityGetUser().getUserName()
>>>> From your Python product use
>>>
>>>	from AccessControl import getSecurityManager
>>>
>>>	user =3D getSecurityManager().getUser()
>>>        name =3D 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/
>