[Zope3-checkins] SVN: Zope3/branches/mgedmin-security/src/zope/app/publisher/browser/globalbrowsermenuservice.py Changed globalbrowsermenuservice to use zope.security.checkPermission.

Marius Gedminas marius at pov.lt
Wed May 12 15:28:34 EDT 2004


Log message for revision 24603:
Changed globalbrowsermenuservice to use zope.security.checkPermission.




-=-
Modified: Zope3/branches/mgedmin-security/src/zope/app/publisher/browser/globalbrowsermenuservice.py
===================================================================
--- Zope3/branches/mgedmin-security/src/zope/app/publisher/browser/globalbrowsermenuservice.py	2004-05-12 19:24:33 UTC (rev 24602)
+++ Zope3/branches/mgedmin-security/src/zope/app/publisher/browser/globalbrowsermenuservice.py	2004-05-12 19:28:27 UTC (rev 24603)
@@ -22,8 +22,9 @@
 from zope.interface.type import TypeRegistry
 from zope.interface import implements
 from zope.security.checker import CheckerPublic
-from zope.security.management import getSecurityManager
-from zope.app.security.permission import checkPermission
+from zope.security import checkPermission
+from zope.app.security.permission import checkPermission \
+                                            as checkPermissionDefined
 from zope.app.component.metaconfigure import handler
 from zope.app.publisher.interfaces.browser import IBrowserMenuService
 from zope.app.publisher.interfaces.browser import IGlobalBrowserMenuService
@@ -92,7 +93,6 @@
 
         result = []
         seen = {}
-        sm = getSecurityManager()
 
         # stuff for figuring out the selected view
         request_url = request.getURL()
@@ -126,8 +126,7 @@
             if permission:
                 # If we have an explicit permission, check that we
                 # can access it.
-                if not sm.checkPermission(permission, object) and \
-                       permission is not CheckerPublic:
+                if not checkPermission(permission, object):
                     continue
 
             elif action:
@@ -216,7 +215,7 @@
             if permission == 'zope.Public':
                 permission = CheckerPublic
             else:
-                checkPermission(None, permission)
+                checkPermissionDefined(None, permission)
 
         data = registry.get(interface) or []
         data.append(




More information about the Zope3-Checkins mailing list