Hi, How do I do the following : <dtml-let user="_.SecurityGetUser()"> I mean the SecurityGetUser() in a PyScript?? ie in the script : user=??? TIA AM ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
Aseem Mohanty wrote:
How do I do the following :
<dtml-let user="_.SecurityGetUser()">
I mean the SecurityGetUser()
user=???
user = context.SecurityGetUser() regards Max M "Sorry I would Really Like To Help More On This Project, But Am To Busy Doing Paid Work On A Tight Deadline" Max M
I get an attribute error for SecurityGetUser()... How to get around that? TIA AM Max M wrote:
Aseem Mohanty wrote:
How do I do the following :
<dtml-let user="_.SecurityGetUser()">
I mean the SecurityGetUser()
user=???
user = context.SecurityGetUser()
regards Max M
"Sorry I would Really Like To Help More On This Project, But Am To Busy Doing Paid Work On A Tight Deadline" Max M
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
Aseem Mohanty wrote:
I get an attribute error for SecurityGetUser()... How to get around that?
TIA AM
Max M wrote:
Aseem Mohanty wrote:
How do I do the following :
<dtml-let user="_.SecurityGetUser()">
I mean the SecurityGetUser()
user=???
user = context.SecurityGetUser()
I did some digging, and the following will work:
from AccessControl import getSecurityManager sm = getSecurityManager() user = sm.getUser() username = user.getUserName() Supposedly, this does not have the problems that AUTHENTICATED_USER has. -- Jim Washington
Actually I found another (easier??) way.. In the bindings tab for PyScript put namespace = _ or for that matter anything else (with restrictions) and then just call _.SecurityGetUser() -AM Jim Washington wrote:
Aseem Mohanty wrote:
I get an attribute error for SecurityGetUser()... How to get around that?
TIA AM
Max M wrote:
Aseem Mohanty wrote:
How do I do the following :
<dtml-let user="_.SecurityGetUser()">
I mean the SecurityGetUser()
user=???
user = context.SecurityGetUser()
I did some digging, and the following will work:
from AccessControl import getSecurityManager sm = getSecurityManager() user = sm.getUser() username = user.getUserName()
Supposedly, this does not have the problems that AUTHENTICATED_USER has.
-- Jim Washington
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
Jim Washington wrote:
I did some digging, and the following will work:
from AccessControl import getSecurityManager sm = getSecurityManager() user = sm.getUser() username = user.getUserName()
This is the correct way to do things in a python script. There may be (or should be? ;-) a utility method to get he current user or user name immediately bu, in any case, the above has less overhead and connotations that binding hte namespace... cheers, Chris
On Mon, 17 Jun 2002 01:47:30 -0700 Aseem Mohanty <aseem@neurobehavioralsystems.com> wrote:
Hi,
How do I do the following :
<dtml-let user="_.SecurityGetUser()">
I mean the SecurityGetUser()
This is a function defined in the DTML module. To get the user in a PythonScript one can use print request.AUTHENTICATED_USER.getUserName() HTH, __Janko -- i.A. Dr. Janko Hauser Software Engineering c o m . u n i t G m b H online-schmiede seit 1994 http://www.comunit.de/ mailto:jh@comunit.de Eiffestr. 598 20537 Hamburg | Germany Fon 040 | 21 11 05 25 Fax 040 | 21 11 05 26
Janko Hauser wrote:
This is a function defined in the DTML module.
To get the user in a PythonScript one can use
print request.AUTHENTICATED_USER.getUserName()
This has been deprecated for a long time for some very good reasons. Please don't recommend it to new users... cheers, Chris
participants (5)
-
Aseem Mohanty -
Chris Withers -
Janko Hauser -
Jim Washington -
Max M