Commit c0cab2db authored by Brian Lloyd's avatar Brian Lloyd

fix sc loss bug

parent 662ae7ae
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
__doc__='''short description __doc__='''short description
$Id: SecurityManagement.py,v 1.9 2004/01/15 23:09:03 tseaver Exp $''' $Id: SecurityManagement.py,v 1.10 2004/01/21 19:59:09 Brian Exp $'''
__version__='$Revision: 1.9 $'[11:-2] __version__='$Revision: 1.10 $'[11:-2]
def getSecurityManager(): def getSecurityManager():
"""Get a security manager, for the current thread. """Get a security manager, for the current thread.
...@@ -32,6 +32,11 @@ def getSecurityManager(): ...@@ -32,6 +32,11 @@ def getSecurityManager():
return manager return manager
def setSecurityManager(manager):
"""install *manager* as current security manager for this thread."""
thread_id=get_ident()
_managers[thread_id]=manager
import SpecialUsers import SpecialUsers
# AccessControl.Implementation inserts SecurityManager. # AccessControl.Implementation inserts SecurityManager.
......
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
""" """
Transient Object Container Class ('timeslice'-based design). Transient Object Container Class ('timeslice'-based design).
$Id: Transience.py,v 1.34 2003/11/28 16:46:11 jim Exp $ $Id: Transience.py,v 1.35 2004/01/21 19:59:09 Brian Exp $
""" """
__version__='$Revision: 1.34 $'[11:-2] __version__='$Revision: 1.35 $'[11:-2]
import Globals import Globals
from Globals import HTMLFile from Globals import HTMLFile
...@@ -27,7 +27,8 @@ from OFS.SimpleItem import SimpleItem ...@@ -27,7 +27,8 @@ from OFS.SimpleItem import SimpleItem
from Persistence import Persistent from Persistence import Persistent
from Acquisition import Implicit from Acquisition import Implicit
from AccessControl import ClassSecurityInfo, getSecurityManager from AccessControl import ClassSecurityInfo, getSecurityManager
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager, \
setSecurityManager
from AccessControl.User import nobody from AccessControl.User import nobody
from BTrees.OOBTree import OOBTree, OOBucket, OOSet from BTrees.OOBTree import OOBTree, OOBucket, OOSet
from BTrees.IOBTree import IOBTree from BTrees.IOBTree import IOBTree
...@@ -276,8 +277,9 @@ class TransientObjectContainer(SimpleItem): ...@@ -276,8 +277,9 @@ class TransientObjectContainer(SimpleItem):
for item in items: for item in items:
if callable(method): if callable(method):
sm = getSecurityManager()
try: try:
user = getSecurityManager().getUser() user = sm.getUser()
try: try:
newSecurityManager(None, nobody) newSecurityManager(None, nobody)
method(item, self) method(item, self)
...@@ -291,7 +293,7 @@ class TransientObjectContainer(SimpleItem): ...@@ -291,7 +293,7 @@ class TransientObjectContainer(SimpleItem):
error=sys.exc_info() error=sys.exc_info()
) )
finally: finally:
newSecurityManager(None, user) setSecurityManager(sm)
else: else:
err = '%s in %s attempted to call non-callable %s' err = '%s in %s attempted to call non-callable %s'
path = self.getPhysicalPath() path = self.getPhysicalPath()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment