[Zope3-checkins]
SVN: Zope3/branches/mgedmin-security/src/zope/security/
Removed getSecurityManager.
Marius Gedminas
marius at pov.lt
Wed May 12 17:18:15 EDT 2004
Log message for revision 24612:
Removed getSecurityManager.
-=-
Modified: Zope3/branches/mgedmin-security/src/zope/security/interfaces.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/security/interfaces.py 2004-05-12 21:14:54 UTC (rev 24611)
+++ Zope3/branches/mgedmin-security/src/zope/security/interfaces.py 2004-05-12 21:18:14 UTC (rev 24612)
@@ -44,9 +44,6 @@
class ISecurityManagement(Interface):
"""Public security management API."""
- def getSecurityManager(): # XXX: going away
- """Get a SecurityManager (create if needed)."""
-
def getSecurityPolicy():
"""Get the system default security policy."""
Modified: Zope3/branches/mgedmin-security/src/zope/security/management.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/security/management.py 2004-05-12 21:14:54 UTC (rev 24611)
+++ Zope3/branches/mgedmin-security/src/zope/security/management.py 2004-05-12 21:18:14 UTC (rev 24612)
@@ -77,17 +77,7 @@
#
# ISecurityManagement implementation
#
-def getSecurityManager():
- """Get a SecurityManager (create if needed)."""
- thread_id = get_ident()
- manager = _managers.get(thread_id, None)
- if manager is None:
- newSecurityManager(None)
- manager = _managers.get(thread_id, None)
-
- return manager
-
def getSecurityPolicy():
"""Get the system default security policy."""
return _getSecurityPolicy()
Modified: Zope3/branches/mgedmin-security/src/zope/security/tests/test_management.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/security/tests/test_management.py 2004-05-12 21:14:54 UTC (rev 24611)
+++ Zope3/branches/mgedmin-security/src/zope/security/tests/test_management.py 2004-05-12 21:18:14 UTC (rev 24612)
@@ -59,24 +59,6 @@
noSecurityManager()
- def test_getSecurityManager(self):
- # This is a test for the case when there is no principal
-
- from zope.security.management import noSecurityManager
- from zope.security.management import replaceSecurityManager
- from zope.security.management import getSecurityManager
-
- noSecurityManager()
- self.failUnless(replaceSecurityManager(None) is None)
-
- mgr = getSecurityManager()
- self.assertEqual(mgr.getPrincipal(), None)
- # XXX maybe add test for default principal case
- self.failIf(mgr.calledByExecutable())
- self.assertEqual(replaceSecurityManager(None), mgr)
-
- noSecurityManager()
-
def _setPermissive(self):
from zope.security.management import setSecurityPolicy
from zope.security.simplepolicies import PermissiveSecurityPolicy
@@ -87,29 +69,6 @@
from zope.security.simplepolicies import ParanoidSecurityPolicy
setSecurityPolicy(ParanoidSecurityPolicy())
- def test_setSecurityPolicy(self):
-
- from zope.security.management import noSecurityManager
- from zope.security.management import getSecurityManager
-
- # test against default policy (paranoid)
- self._setParanoid()
- newSecurityManager('some user')
- mgr = getSecurityManager()
- self.failIf(mgr.checkPermission(None, None))
-
- # test against explicit permissive policy
- self._setPermissive()
- newSecurityManager('some user')
- mgr = getSecurityManager()
- self.failUnless(mgr.checkPermission(None, None))
-
- # test against explicit paranoid policy
- self._setParanoid()
- newSecurityManager('some user')
- mgr = getSecurityManager()
- self.failIf(mgr.checkPermission(None, None))
-
def test_securityPolicy(self):
from zope.security.management import setSecurityPolicy
from zope.security.management import getSecurityPolicy
More information about the Zope3-Checkins
mailing list