[Zope] How to get the current logged on user?

Zachary Wu zachary@combi.com.cn
Tue, 24 Sep 2002 10:51:38 +0800


Thanks Chris Beaven :)
u r right
I always use : from AccessControl import SecurityManager
so got wrong again and again ;p

-------------------------------------------------------


Oops my mistake... I meant:

from AccessControl import getSecurityManager
user = getSecurityManager().getUser()


-----Original Message-----
From: Chris Beaven [mailto:Chris@d-designz.co.nz]
Sent: Tuesday, 24 September 2002 2:37 p.m.
To: Zachary Wu; zope@zope.org
Subject: RE: [Zope] How to get the current logged on user?


context.SecurityGetUser()

-----Original Message-----
From: Zachary Wu [mailto:zachary@combi.com.cn]
Sent: Tuesday, 24 September 2002 2:30 p.m.
To: 'Chris Beaven'; zope@zope.org
Subject: RE: [Zope] How to get the current logged on user?


And how can I use it in python script?
when I use:
us = SecurityGetUser().getUserName()
print us
return printed

teh Zope tell me "SecurityGetUser().getUserName()"
------------------------------------------------------------------------
--------------

global name 'SecurityGetUser' is not defined

Hi Zachary,

It's mentioned in The Zope Book under the Users and Security chapter.

<dtml-var expr="_.SecurityGetUser().getUserName()">

The _.SecurityGetUser() safely calls the getUser() method


-----Original Message-----
From: Zachary Wu [mailto:zachary@combi.com.cn]
Sent: Tuesday, 24 September 2002 1:34 p.m.
To: zope@zope.org
Subject: [Zope] How to get the current logged on user?


I found the function "getUser(self)" in the "Zope book", but I don't
know how to use it. There is no example to show :(

_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )