def test_forbidden_tools( self ): from Products.GenericSetup.tool import TOOLSET_XML from Products.GenericSetup.tool import importToolset TOOL_IDS = ( 'doomed', 'blasted', 'saved' ) site = self._initSite() for tool_id in TOOL_IDS: pseudo = Folder() pseudo._setId( tool_id ) site._setObject( tool_id, pseudo ) self.assertEqual( len( site.objectIds() ), len( TOOL_IDS ) + 1 ) for tool_id in TOOL_IDS: self.failUnless( tool_id in site.objectIds() ) context = DummyImportContext( site, tool=site.setup_tool ) context._files[ TOOLSET_XML ] = _FORBIDDEN_TOOLSET_XML importToolset( context ) self.assertEqual( len( site.objectIds() ), 2 ) self.failUnless( 'setup_tool' in site.objectIds() ) self.failUnless( 'saved' in site.objectIds() )
def _makeSite( self, title="Don't care" ): site = Folder() site._setId( 'site' ) site.title = title self.app._setObject( 'site', site ) return self.app._getOb( 'site' )
def _initSite( self ): from Products.GenericSetup.tool import SetupTool site = Folder() site._setId( 'site' ) self.app._setObject( 'site', site ) site = self.app._getOb( 'site' ) site._setObject('setup_tool', SetupTool('setup_tool')) return site
def _initSite(self): from Products.CMFSetup.tool import SetupTool site = Folder() site._setId('site') self.root._setObject('site', site) site = self.root._getOb('site') site._setObject('portal_setup', SetupTool()) return site
def _initSite( self ): from Products.CMFSetup.tool import SetupTool site = Folder() site._setId( 'site' ) self.root._setObject( 'site', site ) site = self.root._getOb( 'site' ) site._setObject( 'portal_setup', SetupTool() ) return site
def _initSite(self): from Products.GenericSetup.tool import SetupTool site = Folder() site._setId('site') self.root._setObject('site', site) site = self.root._getOb('site') site._setObject('setup_tool', SetupTool('setup_tool')) return site
def test__setObject_no_ownership_fixup(self): from AccessControl.SpecialUsers import emergency_user from OFS.Folder import Folder newSecurityManager(None, emergency_user) rc, root, folder, object = self._makeTree() zcuf = self._makeOne() folder._setObject('acl_users', zcuf) zcuf = folder._getOb('acl_users') sub = Folder() sub._setId('sub') zcuf._setObject('sub', sub)
def test__setObject_no_ownership_fixup( self ): from AccessControl.SpecialUsers import emergency_user from OFS.Folder import Folder newSecurityManager( None, emergency_user ) rc, root, folder, object = self._makeTree() zcuf = self._makeOne() folder._setObject( 'acl_users', zcuf ) zcuf = folder._getOb( 'acl_users' ) sub = Folder() sub._setId( 'sub' ) zcuf._setObject( 'sub', sub )
def setUp(self): self.root = Folder() self.root.getPhysicalPath = lambda: () self.root.getPhysicalRoot = lambda r=self.root: r self.root.composite_tool = CompositeTool() self.tool = self.root.composite_tool self.tool._check_security = 0 self.root.slot = Slot("slot") self.slot = self.root.slot f = Folder() f._setId("f") self.slot._setObject(f.id, f) g = Folder() g._setId("g") self.slot._setObject(g.id, g) self.root.otherslot = Slot("otherslot") self.old_policy = setSecurityPolicy(PermissiveSecurityPolicy()) noSecurityManager()
def setUp(self): from AccessControl.SecurityManagement import noSecurityManager from AccessControl.SecurityManager import setSecurityPolicy from OFS.Folder import Folder from Products.CompositePage.slot import Slot from Products.CompositePage.tool import CompositeTool self.root = Folder() self.root.getPhysicalPath = lambda: () self.root.getPhysicalRoot = lambda r=self.root: r self.root.composite_tool = CompositeTool() self.tool = self.root.composite_tool self.tool._check_security = 0 self.root.slot = Slot("slot") self.slot = self.root.slot f = Folder() f._setId("f") self.slot._setObject(f.id, f) g = Folder() g._setId("g") self.slot._setObject(g.id, g) self.root.otherslot = Slot("otherslot") self.old_policy = setSecurityPolicy(PermissiveSecurityPolicy()) noSecurityManager()