--On 16. Juli 2005 19:54:52 +0200 Jan-Ole Esleben <[EMAIL PROTECTED]> wrote:

Hi!

I can't seem to figure out from the documentation or through web
research how it is possible to change the currently logged in user
pythonically (e.g. in an fs product or extension method).

Can anybody give me a hint?


Something like this should work (taken from zopewiki.org):

In [10]?: from AccessControl?.SecurityManagement? import newSecurityManager, getSecurityManager
In [11]?: user = app.acl_users.getUser('jean').__of__(app.portal.acl_users)
In [12]?: newSecurityManager(None, user)
In [13]?: getSecurityManager().getUser() # just to verify it.
Out[13]?: jean
In [14]?: app.fab.materials.invokeFactory('Material', 'test11')
In [15]?: mat = getattr(app.fab.materials, 'test11')
In [16]?: mat
Out[16]?: <Material at /fab/materials/test11>

-aj

Attachment: pgpxtmsJD2m7l.pgp
Description: PGP signature

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

Reply via email to