[Zope] Testing security in a debug session?

Paul Winkler pw_lists@slinkp.com
Fri, 28 Feb 2003 10:42:25 -0500


Thanks Sean & Chris, works great!
I'm off to post this as a ZopeLabs recipe (with proper credits of course).

--PW


On Thu, Feb 27, 2003 at 03:26:25PM -0800, sean.upton@uniontrib.com wrote:
> getUser() does not return a user wrapped in the acquistion context of the
> user folder (which newSecurityManager() needs), so this code will likely
> need the first line changed to:
> 
> user = app.acl_users.getUser('foo').__of__(app.acl_users)
> 
> Sean
> 
> -----Original Message-----
> From: Chris McDonough [mailto:chrism@zope.com]
> Sent: Thursday, February 27, 2003 3:12 PM
> To: Paul Winkler
> Cc: zope@zope.org
> Subject: Re: [Zope] Testing security in a debug session?
> 
> 
> Something like this:
> 
> user = app.acl_users.getUser('foo')
> from AccessControl.SecurityManagement import newSecurityManager
> newSecurityManager(None, user)
> 
> 
> On Thu, 2003-02-27 at 17:42, Paul Winkler wrote:
> > how do I test as a particular user in a debug session?
> > things like has_permission are failing because 
> > getSecurityManager().getUser() returns 'Anonymous User'.
> > 
> > I remember seeing something about how to do this recently, but
> > I can't find it for the life of me and i've been looking for
> > hours :(
> > 
> > -- 
> > 
> > Paul Winkler
> > http://www.slinkp.com
> > 
> > 
> > _______________________________________________
> > 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 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 )

-- 

Paul Winkler
http://www.slinkp.com