Jean Jordaan wrote:
Hi all
Does anyone know how I can "be someone" besides Anonymous when debugging Zope? This works:
""" In [80]: Zope.debug('/fab/materials/invokeFactory?type_name=Material&id=test2', u='user:secret', )
____________________________________________________________
Status: 302 Moved Temporarily X-Powered-By: Zope (www.zope.org), Python (www.python.org) Content-Length: 5 Content-Type: text/plain Location: http://localhost/Zope/fab/materials/test2/base_edit
test2 """
But I want to do stuff like:
""" In [83]: at = app.fab.materials.invokeFactory('Material', 'test3') [...] Unauthorized: Your user account is defined outside the context of the object being accessed. Access to 'addMaterial' of (__FactoryDispatcher__ instance at 41c540d0) denied. Your user account, jean, exists at /acl_users. Access requires Fabrinox__Add_Materials_Permission, granted to the following roles: ['Manager']. """
Hey! I'm not Anonymous! :) It still doesn't work though. Without that Zope.debug call I would've got
""" Unauthorized: Your user account does not have the required permission. Access to 'addMaterial' of (__FactoryDispatcher__ instance at 419f0a00) denied. Your user account, Anonymous User, exists at (unknown). Access requires Fabrinox__Add_Materials_Permission, granted to the following roles: ['Manager']. Your roles in this context are ['Anonymous']. """
Hmmm, now does anyone know how I can get hold of that user object so that I can try and make it __of__(portal)?
Look at Products.CMFCore.tests.base.testcase.SecurityTest.setUp. Tres. -- =============================================================== Tres Seaver tseaver@zope.com Zope Corporation "Zope Dealers" http://www.zope.com