----- Original Message ----- From: "Will Stephenson" <lists@stevello.free-online.co.uk> To: <zope@zope.org> Sent: Monday, November 10, 2003 10:39 PM Subject: [Zope] Accessing user id in scripts
Hi all
I'm planning a site where users and site structure are held in Zope, but the data items belonging to users are held in an RDBMS, due to their number and relative light weight.
I've designed the database so that owned objects have a userid field, and am about to add a mySqlUserFolder for site users, but I'm stuck trying to see how to get a user id from the session so that I can use it my scripts that then call Z SQL methods to do database accesses (insert into things (owner, thing ) values( 'joe123', 'newthing').
I dunno lots about mySqlUserFolder but you hould always get the user object this way whaterver's the user folder you use. from AccessControl import getSecurityManager ... userObject = getSecurityManager().getUser() # then play with the standard API of the Zope user as usual You don't need playing with sessioning or persistence of authentication. The user folder should assume this. Imagine the mess if the various Zope classes should care about the specific stuff of such or such user folder. HTH --Gilles