[CMF-checkins] CVS: CMF/CMFCore - FSMetadata.py:1.3 FSPythonScript.py:1.21 FSDTMLMethod.py:1.16 DirectoryView.py:1.38

Andy McKay andy@agmweb.ca
Mon, 24 Mar 2003 00:03:09 -0500


Update of /cvs-repository/CMF/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv3222

Modified Files:
	FSMetadata.py FSPythonScript.py FSDTMLMethod.py 
	DirectoryView.py 
Log Message:
Add proxies for DTML methods and Python scripts


=== CMF/CMFCore/FSMetadata.py 1.2 => 1.3 ===
--- CMF/CMFCore/FSMetadata.py:1.2	Fri Mar 14 12:38:49 2003
+++ CMF/CMFCore/FSMetadata.py	Mon Mar 24 00:03:08 2003
@@ -46,6 +46,14 @@
             self._properties = self._old_readProperties()
             self._security = self._old_readSecurity()
 
+    def getProxyRoles(self):
+        """ Returns the proxy roles """
+        if self.getProperties():
+            pxy = self.getProperties().get('proxy')
+            if pxy:
+                return [r.strip() for r in pxy.split(',') if r.strip()]
+        return []
+
     def getSecurity(self):
         """ Gets the security settings """
         return self._security


=== CMF/CMFCore/FSPythonScript.py 1.20 => 1.21 ===
--- CMF/CMFCore/FSPythonScript.py:1.20	Fri Nov  8 19:25:23 2002
+++ CMF/CMFCore/FSPythonScript.py	Mon Mar 24 00:03:08 2003
@@ -46,7 +46,8 @@
     meta_type = 'Filesystem Script (Python)'
     _params = _body = ''
     _v_f = None
-
+    _proxy_roles = ()
+    
     manage_options=(
         (
             {'label':'Customize', 'action':'manage_main'},
@@ -197,6 +198,9 @@
 
     security.declareProtected(ViewManagementScreens, 'params')
     def params(self): return self._params
+
+    security.declareProtected(ViewManagementScreens, 'manage_haveProxy')
+    manage_haveProxy = PythonScript.manage_haveProxy
 
     security.declareProtected(ViewManagementScreens, 'body')
     def body(self): return self._body


=== CMF/CMFCore/FSDTMLMethod.py 1.15 => 1.16 ===
--- CMF/CMFCore/FSDTMLMethod.py:1.15	Thu Feb 20 10:16:51 2003
+++ CMF/CMFCore/FSDTMLMethod.py	Mon Mar 24 00:03:08 2003
@@ -21,6 +21,7 @@
 import Globals
 from AccessControl import ClassSecurityInfo, getSecurityManager, Permissions
 from OFS.DTMLMethod import DTMLMethod, decapitate, guess_content_type
+from AccessControl.Role import RoleManager
 
 from utils import _dtmldir
 from CMFCorePermissions import View
@@ -39,7 +40,7 @@
 
 _marker = []  # Create a new marker object.
 
-class FSDTMLMethod(RestrictedDTML, FSObject, Globals.HTML):
+class FSDTMLMethod(RestrictedDTML, RoleManager, FSObject, Globals.HTML):
     """FSDTMLMethods act like DTML methods but are not directly
     modifiable from the management interface."""
 
@@ -50,10 +51,13 @@
             {'label':'Customize', 'action':'manage_main'},
             {'label':'View', 'action':'',
              'help':('OFSP','DTML-DocumentOrMethod_View.stx')},
+            {'label':'Proxy', 'action':'manage_proxyForm',
+             'help':('OFSP','DTML-DocumentOrMethod_Proxy.stx')},
             )
             +Cacheable.manage_options
         )
 
+    _proxy_roles=()
     _cache_namespace_keys=()
 
     # Use declarative security
@@ -186,6 +190,9 @@
 
     security.declareProtected(ViewManagementScreens, 'document_src')
     document_src = DTMLMethod.document_src
+
+    security.declareProtected(ViewManagementScreens, 'manage_haveProxy')
+    manage_haveProxy = DTMLMethod.manage_haveProxy
 
 Globals.InitializeClass(FSDTMLMethod)
 


=== CMF/CMFCore/DirectoryView.py 1.37 => 1.38 ===
--- CMF/CMFCore/DirectoryView.py:1.37	Fri Mar 14 16:15:07 2003
+++ CMF/CMFCore/DirectoryView.py	Mon Mar 24 00:03:08 2003
@@ -240,9 +240,19 @@
                     except:
                         LOG('DirectoryView',
                             ERROR,
-                            'Error setting permission from .security file information',
+                            'Error setting permissions',
                             error=exc_info())
 
+                    # only DTML Methods can have proxy roles
+                    if hasattr(ob, '_proxy_roles'):
+                        try:
+                            ob._proxy_roles = tuple(metadata.getProxyRoles())
+                        except:
+                            LOG('DirectoryView',
+                                ERROR,
+                                'Error setting proxy role',
+                                error=exc_info())
+                    
                     ob_id = ob.getId()
                     data[ob_id] = ob
                     objects.append({'id': ob_id, 'meta_type': ob.meta_type})