Re: [Zope] Change user (pythonic)

2005-07-16 Thread Andreas Jung



--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]?: 

-aj


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 )


[Zope] Change user (pythonic)

2005-07-16 Thread Jan-Ole Esleben
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?

TIA,
Ole
___
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 )