def importFinalSteps(context): """ Final Plone import steps. """ # Only run step if a flag file is present (e.g. not an extension profile) if context.readDataFile('plone-final.txt') is None: return site = context.getSite() setProfileVersion(site) # Install our dependencies st = getToolByName(site, "portal_setup") st.runAllImportStepsFromProfile("profile-Products.CMFPlone:dependencies") assignTitles(site) replace_local_role_manager(site) addCacheHandlers(site) addCacheForResourceRegistry(site) # check if zope root has keyring installed for CSRF protection app = aq_parent(site) sm = getSiteManager(app) if sm.queryUtility(IKeyManager) is None: obj = KeyManager() sm.registerUtility(aq_base(obj), IKeyManager, '')
def importFinalSteps(context): """ Final Plone import steps. """ # Only run step if a flag file is present (e.g. not an extension profile) if context.readDataFile('plone-final.txt') is None: return site = context.getSite() # Unset all profile upgrade versions in portal_setup. Our default # profile should only be applied when creating a new site, so this # list of versions should be empty. But some tests apply it too. # This should not be done as it should not be needed. The profile # is a base profile, which means all import steps are run in purge # mode. So for example an extra workflow added by # plone.app.discussion is purged. When plone.app.discussion is # still in the list of profile upgrade versions, with the default # dependency strategy it will not be reapplied again, which leaves # you with a site that misses stuff. So: when applying our # default profile, start with a clean slate in these versions. purgeProfileVersions(site) # Set out default profile version. setProfileVersion(site) # Install our dependencies st = getToolByName(site, "portal_setup") st.runAllImportStepsFromProfile("profile-Products.CMFPlone:dependencies") assignTitles(site) replace_local_role_manager(site) addCacheHandlers(site) addCacheForResourceRegistry(site)
def importFinalSteps(context): """ Final Plone import steps. """ # Only run step if a flag file is present (e.g. not an extension profile) if context.readDataFile('plone-final.txt') is None: return site = context.getSite() setProfileVersion(site) # Install our dependencies st = getToolByName(site, "portal_setup") st.runAllImportStepsFromProfile("profile-Products.CMFPlone:dependencies") assignTitles(site) replace_local_role_manager(site) addCacheHandlers(site) addCacheForResourceRegistry(site) # check if zope root has keyring installed for CSRF protection app = aq_parent(site) sm = getSiteManager(app) if sm.queryUtility(IKeyManager) is None: obj = KeyManager() sm.registerUtility(aq_base(obj), IKeyManager, '') first_weekday_setup(context) timezone_setup(context) # setup resource overrides plone.resource persistentDirectory = getUtility(IResourceDirectory, name="persistent") if OVERRIDE_RESOURCE_DIRECTORY_NAME not in persistentDirectory: persistentDirectory.makeDirectory(OVERRIDE_RESOURCE_DIRECTORY_NAME)
def testReplaceLocalRoleManager(self): # first we replace the local role manager with the one from PlonePAS uf = self.portal.acl_users # deactivate and remove the borg plugin uf.plugins.removePluginById('borg_localroles') uf.manage_delObjects(['borg_localroles']) # activate the standard plugin uf.plugins.activatePlugin(ILocalRolesPlugin, 'local_roles') # Bring things back to normal replace_local_role_manager(self.portal) plugins = uf.plugins.listPlugins(ILocalRolesPlugin) self.failUnlessEqual(len(plugins), 1) self.failUnlessEqual(plugins[0][0], 'borg_localroles')
def testReplaceLocalRoleManager(self): # first we replace the local role manager with the one from PlonePAS uf = self.portal.acl_users # deactivate and remove the borg plugin uf.plugins.removePluginById('borg_localroles') uf.manage_delObjects(['borg_localroles']) # activate the standard plugin uf.plugins.activatePlugin(ILocalRolesPlugin, 'local_roles') # Bring things back to normal replace_local_role_manager(self.portal) plugins = uf.plugins.listPlugins(ILocalRolesPlugin) self.assertEqual(len(plugins), 1) self.assertEqual(plugins[0][0], 'borg_localroles')
def testReplaceLocalRoleManagerNoPlugin(self): # first we replace the local role manager with the one from PlonePAS uf = self.portal.acl_users # deactivate and remove the borg plugin uf.plugins.removePluginById('borg_localroles') uf.manage_delObjects(['borg_localroles']) # delete the standard plugin uf.manage_delObjects(['local_roles']) # Run the upgrade, which shouldn't fail even if the expected # plugin is missing replace_local_role_manager(self.portal) plugins = uf.plugins.listPlugins(ILocalRolesPlugin) self.failUnlessEqual(len(plugins), 1) self.failUnlessEqual(plugins[0][0], 'borg_localroles')
def testReplaceLocalRoleManagerTwice(self): # first we replace the local role manager with the one from PlonePAS uf = self.portal.acl_users # deactivate and remove the borg plugin uf.plugins.removePluginById('borg_localroles') uf.manage_delObjects(['borg_localroles']) # activate the standard plugin uf.plugins.activatePlugin(ILocalRolesPlugin, 'local_roles') # run the upgrade twice replace_local_role_manager(self.portal) replace_local_role_manager(self.portal) plugins = uf.plugins.listPlugins(ILocalRolesPlugin) self.assertEqual(len(plugins), 1) self.assertEqual(plugins[0][0], 'borg_localroles')
def testReplaceLocalRoleManagerNoPlugin(self): # first we replace the local role manager with the one from PlonePAS uf = self.portal.acl_users # deactivate and remove the borg plugin uf.plugins.removePluginById('borg_localroles') uf.manage_delObjects(['borg_localroles']) # delete the standard plugin uf.manage_delObjects(['local_roles']) # Run the upgrade, which shouldn't fail even if the expected # plugin is missing replace_local_role_manager(self.portal) plugins = uf.plugins.listPlugins(ILocalRolesPlugin) self.assertEqual(len(plugins), 1) self.assertEqual(plugins[0][0], 'borg_localroles')
def testReplaceLocalRoleManagerTwice(self): # first we replace the local role manager with the one from PlonePAS uf = self.portal.acl_users # deactivate and remove the borg plugin uf.plugins.removePluginById('borg_localroles') uf.manage_delObjects(['borg_localroles']) # activate the standard plugin uf.plugins.activatePlugin(ILocalRolesPlugin, 'local_roles') # run the upgrade twice replace_local_role_manager(self.portal) replace_local_role_manager(self.portal) plugins = uf.plugins.listPlugins(ILocalRolesPlugin) self.failUnlessEqual(len(plugins), 1) self.failUnlessEqual(plugins[0][0], 'borg_localroles')
def three0_beta1(portal): """3.0.6 -> 3.1-beta1 """ out = [] loadMigrationProfile(portal, 'profile-plone.app.upgrade.v31:3.0.6-3.1beta1') addBrowserLayer(portal, out) addCollectionAndStaticPortlets(portal, out) migratePortletTypeRegistrations(portal, out) removeDoubleGenericSetupSteps(portal, out) reinstallCMFPlacefulWorkflow(portal, out) replace_local_role_manager(portal) return out
def importFinalSteps(context): """ Final Plone import steps. """ # Only run step if a flag file is present (e.g. not an extension profile) if context.readDataFile('plone-final.txt') is None: return site = context.getSite() setProfileVersion(site) # Install our dependencies st = getToolByName(site, "portal_setup") st.runAllImportStepsFromProfile("profile-Products.CMFPlone:dependencies") assignTitles(site) replace_local_role_manager(site) addCacheHandlers(site) addCacheForResourceRegistry(site)
def importFinalSteps(context): """Final Plone import steps. This was an import step, but is now registered as post_handler specifically for our main 'plone' (profiles/default) profile. """ site = getSite() # Unset all profile upgrade versions in portal_setup. Our default # profile should only be applied when creating a new site, so this # list of versions should be empty. But some tests apply it too. # This should not be done as it should not be needed. The profile # is a base profile, which means all import steps are run in purge # mode. So for example an extra workflow added by # plone.app.discussion is purged. When plone.app.discussion is # still in the list of profile upgrade versions, with the default # dependency strategy it will not be reapplied again, which leaves # you with a site that misses stuff. So: when applying our # default profile, start with a clean slate in these versions. purgeProfileVersions(site) # Set out default profile version. setProfileVersion(site) # Install our dependencies st = getToolByName(site, "portal_setup") st.runAllImportStepsFromProfile( "profile-Products.CMFPlone:dependencies") assignTitles(site) replace_local_role_manager(site) addCacheHandlers(site) addCacheForResourceRegistry(site) first_weekday_setup(context) timezone_setup(context) external_editor_permissions(site) set_zsqlmethods_permissions(site) # setup resource overrides plone.resource persistentDirectory = getUtility(IResourceDirectory, name="persistent") if OVERRIDE_RESOURCE_DIRECTORY_NAME not in persistentDirectory: persistentDirectory.makeDirectory(OVERRIDE_RESOURCE_DIRECTORY_NAME)
def importFinalSteps(context): """Final Plone import steps. This was an import step, but is now registered as post_handler specifically for our main 'plone' (profiles/default) profile. """ site = getSite() # Unset all profile upgrade versions in portal_setup. Our default # profile should only be applied when creating a new site, so this # list of versions should be empty. But some tests apply it too. # This should not be done as it should not be needed. The profile # is a base profile, which means all import steps are run in purge # mode. So for example an extra workflow added by # plone.app.discussion is purged. When plone.app.discussion is # still in the list of profile upgrade versions, with the default # dependency strategy it will not be reapplied again, which leaves # you with a site that misses stuff. So: when applying our # default profile, start with a clean slate in these versions. purgeProfileVersions(site) # Set out default profile version. setProfileVersion(site) # Install our dependencies st = getToolByName(site, "portal_setup") st.runAllImportStepsFromProfile( "profile-Products.CMFPlone:dependencies") assignTitles(site) replace_local_role_manager(site) addCacheHandlers(site) first_weekday_setup(context) timezone_setup(context) external_editor_permissions(site) set_zsqlmethods_permissions(site) # setup resource overrides plone.resource persistentDirectory = getUtility(IResourceDirectory, name="persistent") if OVERRIDE_RESOURCE_DIRECTORY_NAME not in persistentDirectory: persistentDirectory.makeDirectory(OVERRIDE_RESOURCE_DIRECTORY_NAME)
def testReplaceLocalRoleManagerNoUF(self): # Delete the user folder replace_local_role_manager(self.portal)
def testReplaceLocalRoleManagerNoPAS(self): uf = self.portal.acl_users # delete the plugin registry uf._delObject('plugins') replace_local_role_manager(self.portal)