[Zope] Setting user when debugging

Chris McDonough chrism@digicool.com
Mon, 21 May 2001 07:29:13 -0700


Here's an example of changing to a new user within the debugger
(untested):


import Zope
app = Zope.app()
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
dave = app.acl_users.getUser('dave')
newSecurityManager(None, dave) # switch to dave user
... do stuff ..
noSecurityManager() # back to anon


Bernie Simon wrote:
> 
> When I ran Zope under the Python debugger, I was logged in as 'Anonymous
> User'. What python command should I run to change to another user?
> 
> --
> Bernie Simon                    Solving yesterday's problems tomorrow
> 
> _______________________________________________
> 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 )