Obtaining the User's Name from a Python Script in Zope
I have used the getUserName() function in page templates and passed that name as a parameter to python scripts in Zope. But, now I need to independently verify the authenticated user from a script, not relying on anything passed in from a page. Is it possible to do so, and if so, how? The basic need is to obtain the logged in user's name from a script directly from Zope from within a python script. If this should be posted to another list, please let me know. Regards, Tom Nichols tom@westlong.com
On ma, 21.07.2003 at 11:02 -0600, Tom Nichols wrote:
I have used the getUserName() function in page templates and passed that name as a parameter to python scripts in Zope. But, now I need to independently verify the authenticated user from a script, not relying on anything passed in from a page. Is it possible to do so, and if so, how? The basic need is to obtain the logged in user's name from a script directly from Zope from within a python script.
print container.REQUEST.AUTHENTICATED_USER.getUserName() return printed -- paavo. "joskus voi tää meno käydä ahdistavaksi kun on täällä muodostunut tavaksi muuttaa jokaisen elämän arvo rahaksi"
Tom Nichols wrote:
I have used the getUserName() function in page templates and passed that name as a parameter to python scripts in Zope. But, now I need to independently verify the authenticated user from a script
from AccessControl import getSecurityManager user = getSecurityManager().getUser() username = user.getUserName() Cheers, Evan @ 4-am.com
participants (3)
-
Evan Simpson -
Paavo Parkkinen -
Tom Nichols