From f6f2ffc325127b931a1f92aee134e877c2e37311 Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Wed, 28 Jan 2009 13:42:26 +0000 Subject: [PATCH] Restore security manager to original one instead to no security manager (Anonymous User). Fix import section. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25333 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Wizard/Tool/WizardTool.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/product/ERP5Wizard/Tool/WizardTool.py b/product/ERP5Wizard/Tool/WizardTool.py index 1a0c4895ae..d9707c6c1f 100644 --- a/product/ERP5Wizard/Tool/WizardTool.py +++ b/product/ERP5Wizard/Tool/WizardTool.py @@ -38,9 +38,8 @@ from zLOG import LOG, INFO, WARNING, ERROR, DEBUG from cStringIO import StringIO from UserDict import UserDict import xmlrpclib, socket, sys, traceback, urllib, urllib2, base64, cgi -from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager -import zLOG -import cookielib +from AccessControl.SecurityManagement import newSecurityManager, getSecurityManager, setSecurityManager +import zLOG, cookielib from urlparse import urlparse, urlunparse from base64 import encodestring, decodestring from urllib import quote, unquote @@ -85,8 +84,9 @@ def _getAcCookieFromServer(url, opener, cookiejar, username, password, header_di def _setSuperSecurityManager(self): """ Change to super user account. """ - user = self.getWrappedOwner() - newSecurityManager(self.REQUEST, user) + original_security_manager = getSecurityManager() + newSecurityManager(self.REQUEST, self.getWrappedOwner()) + return original_security_manager class GeneratorCall(UserDict): """ Class use to generate/interpret XML-RPC call for the wizard. """ @@ -521,7 +521,7 @@ class WizardTool(BaseTool): global installation_status if use_super_manager: # set current security manager to owner of site - _setSuperSecurityManager(self.getPortalObject()) + original_security_manager = _setSuperSecurityManager(self.getPortalObject()) portal = self.getPortalObject() bt5_files = server_response.get("filedata", []) @@ -579,7 +579,7 @@ class WizardTool(BaseTool): LOG("Wizard", INFO, "Completed installation for %s" %' '.join(bt5_filenames)) if use_super_manager: - noSecurityManager() + setSecurityManager(original_security_manager) ###################################################### ## Navigation ## @@ -828,10 +828,10 @@ class WizardTool(BaseTool): security.declareProtected(Permissions.View, 'getExpressConfigurationPreference') def getExpressConfigurationPreference(self, preference_id, default = None): """ Get Express configuration preference """ - _setSuperSecurityManager(self.getPortalObject()) + original_security_manager = _setSuperSecurityManager(self.getPortalObject()) portal_preferences = getToolByName(self, 'portal_preferences') preference_value = portal_preferences.getPreference(preference_id, default) - noSecurityManager() + setSecurityManager(original_security_manager) return preference_value security.declareProtected(Permissions.ModifyPortalContent, 'setExpressConfigurationPreference') -- 2.30.9