[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/File - IFile.py:1.1.2.3 file.zcml:1.1.2.3

Gary Poster garyposter@earthlink.net
Thu, 2 May 2002 13:18:18 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/File
In directory cvs.zope.org:/tmp/cvs-serv28126/lib/python/Zope/App/OFS/Content/File

Modified Files:
      Tag: Zope-3x-branch
	IFile.py file.zcml 
Log Message:
Several interfaces divided up into readers (getters) and writers (setters), then used in the zcml for permissions.  Some small changes in the local ServiceManager to deal with the new security a bit better, hopefully.  Fixed Image enough so that you can upload one, but I'm getting a server buffer error when I try to view it.  The change to ZMIViewUtility I'm not sure of, but it made sense to me.

You can now add, edit, and view significantly more of the content since the security changes.



=== Zope3/lib/python/Zope/App/OFS/Content/File/IFile.py 1.1.2.2 => 1.1.2.3 ===
 from Interface import Interface
 
+class IReadFile(Interface):
+    
 
-class IFile(Interface):
-    """The basic methods that are required to implement
-       a file as a Zope Content object.
+    def getData():
+        """Returns the bits (data) of the File itself."""
 
-    """
+
+    def getContentType():
+        """Returns the content type of the file using mime-types syntax."""
+
+
+    def getSize():
+        """Return the size of the file.
+
+        Note that only the file's content is counted and not the entire
+        Python object.
+        """
+
+class IWriteFile(Interface):
 
 
     def edit(data, contentType=None):
@@ -36,24 +49,15 @@
 
     def setData(data):
         """Sets ONLY the data without changing the content type."""
-    
-
-    def getData():
-        """Returns the bits (data) of the File itself."""
 
 
     def setContentType(contentType):
         """Sets the content type of the file."""
 
 
-    def getContentType():
-        """Returns the content type of the file using mime-types syntax."""
-
-
-    def getSize():
-        """Return the size of the file.
+class IFile(IReadFile, IWriteFile):
+    """The basic methods that are required to implement
+       a file as a Zope Content object.
 
-        Note that only the file's content is counted and not the entire
-        Python object.
-        """
+    """
         


=== Zope3/lib/python/Zope/App/OFS/Content/File/file.zcml 1.1.2.2 => 1.1.2.3 ===
   <!-- NaiveFile Directives -->
 
-  <security:permission permission_id="Zope.AddNaiveFiles" 
+  <!--security:permission permission_id="Zope.AddNaiveFiles" 
                        title="Add Naive Files" />
 
   <zmi:factoryFromClass name="NaiveFile"
@@ -16,7 +16,7 @@
                     	description="This is a simple file" />
 
   <security:protectClass name=".NaiveFile."
-                         permission_id="Zope.View" />
+                         permission_id="Zope.View" /-->
 
 
   <!-- File Directives -->
@@ -25,13 +25,19 @@
 
   <zmi:factoryFromClass name="File"
                     	class=".File."
-                    	permission_id="Zope.AddFiles"
+                    	permission_id="Zope.ManageContent"
                     	title="File"
                     	description="A File" />
 
   <security:protectClass name=".File."
-                         permission_id="Zope.View" />
-
+                         permission_id="Zope.View" >
+    <security:protect
+              interface="Zope.App.OFS.Content.File.IFile.IReadFile"
+              permission_id="Zope.View" />
+    <security:protect
+              interface="Zope.App.OFS.Content.File.IFile.IWriteFile"
+              permission_id="Zope.ManageContent" />
+  </security:protectClass>
 
   <!-- tabs for folder -->