[Zope-CMF] another quick one

Tres Seaver tseaver@palladion.com
Mon, 13 Aug 2001 07:27:01 -0400


Florent Guillaume wrote:

> CMFCore.PortalContent has:
> 
>     def _verifyActionPermissions(self, action):
>         pp = action.get('permissions', ())
>         if not pp:
>             return 1
>         sm = getSecurityManager()
>         for p in pp:
>             if _checkPermission(p, self):
>                 return 1
>         return 0
> 
> Here we do nothing with sm... any intended effect ?

Its a fossil -- the code used to use the 'SecurityManager.checkPermission'
API, which is broken in Zope 2.3.3;  switching to use the local
'_checkPermission' function was the workaround.

I've just checked in this patch to remove it:

-----------------------------------------------------------
diff -u -r1.23 PortalContent.py
--- CMFCore/PortalContent.py	10 Aug 2001 18:52:44 -0000	1.23
+++ CMFCore/PortalContent.py	13 Aug 2001 11:49:01 -0000
@@ -87,7 +87,7 @@
  from DateTime import DateTime
  from Globals import InitializeClass
  from OFS.SimpleItem import SimpleItem
-from AccessControl import ClassSecurityInfo, getSecurityManager
+from AccessControl import ClassSecurityInfo
  from CMFCorePermissions import AccessContentsInformation, View, \
       ReviewPortalContent, ModifyPortalContent
  import CMFCorePermissions
@@ -204,7 +204,6 @@
          pp = action.get('permissions', ())
          if not pp:
              return 1
-        sm = getSecurityManager()
          for p in pp:
              if _checkPermission(p, self):
                  return 1
-----------------------------------------------------------


Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com