[Zope-Checkins] CVS: Zope/lib/python/Products/ZCatalog - ZCatalog.py:1.111 ZCatalogIndexes.py:1.7

Casey Duncan casey@zope.com
Fri, 28 Jun 2002 13:25:25 -0400


Update of /cvs-repository/Zope/lib/python/Products/ZCatalog
In directory cvs.zope.org:/tmp/cvs-serv3905/lib/python/Products/ZCatalog

Modified Files:
	ZCatalog.py ZCatalogIndexes.py 
Log Message:
ZCatalog Fixup:

  * Collector #446 - Index managment permissions fixed

  * Index managment ui is now integrated into ZCatalog rather than being
    a tab leading to the Indexes subobject manage_main

ZCTextIndex fixed to work under this management scheme and now can be instantiated without that silly "extra" record thingy.


=== Zope/lib/python/Products/ZCatalog/ZCatalog.py 1.110 => 1.111 ===
          'help': ('OFSP','Properties.stx')},
         {'label': 'Indexes',            # TAB: Indexes
-         'action': 'Indexes/manage_workspace',
+         'action': 'manage_catalogIndexes',
          'help': ('ZCatalog','ZCatalog_Indexes.stx')},
         {'label': 'Metadata',           # TAB: Metadata
          'action': 'manage_catalogSchema', 
@@ -347,7 +347,7 @@
         self.addIndex(name, type,extra)
 
         if REQUEST and RESPONSE:
-            RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Index%20Added')
+            RESPONSE.redirect(URL1 + '/manage_catalogIndexes?manage_tabs_message=Index%20Added')
         
 
     def manage_deleteIndex(self, ids=None, REQUEST=None, RESPONSE=None,
@@ -371,7 +371,7 @@
         if not ids:
             return MessageDialog(title='No items specified',
                 message='No items were specified!',
-                action = "./manage_main",)
+                action = "./manage_catalogIndexes",)
 
         if isinstance(ids, types.StringType):
             ids = (ids,)
@@ -380,7 +380,7 @@
             self.delIndex(name)
         
         if REQUEST and RESPONSE:
-            RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Index%20Deleted')
+            RESPONSE.redirect(URL1 + '/manage_catalogIndexes?manage_tabs_message=Index%20Deleted')
 
 
     def manage_clearIndex(self, ids=None, REQUEST=None, RESPONSE=None,
@@ -389,7 +389,7 @@
         if not ids:
             return MessageDialog(title='No items specified',
                 message='No items were specified!',
-                action = "./manage_main",)
+                action = "./manage_catalogIndexes",)
 
         if isinstance(ids, types.StringType):
             ids = (ids,)
@@ -398,7 +398,7 @@
             self.clearIndex(name)
         
         if REQUEST and RESPONSE:
-            RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Index%20Cleared')
+            RESPONSE.redirect(URL1 + '/manage_catalogIndexes?manage_tabs_message=Index%20Cleared')
 
 
     def reindexIndex(self,name,REQUEST):
@@ -418,7 +418,7 @@
         if not ids:
             return MessageDialog(title='No items specified',
                 message='No items were specified!',
-                action = "./manage_main",)
+                action = "./manage_catalogIndexes",)
                 
         if isinstance(ids, types.StringType):
             ids = (ids,)
@@ -427,7 +427,7 @@
             self.reindexIndex(name, REQUEST)
 
         if REQUEST and RESPONSE:
-            RESPONSE.redirect(URL1 + '/manage_main?manage_tabs_message=Reindexing%20Performed')
+            RESPONSE.redirect(URL1 + '/manage_catalogIndexes?manage_tabs_message=Reindexing%20Performed')
 
 
     def availableSplitters(self):


=== Zope/lib/python/Products/ZCatalog/ZCatalogIndexes.py 1.6 => 1.7 ===
 ##############################################################################
 
+"""$Id$
+"""
+
 from  Globals import DTMLFile, InitializeClass
 from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.Permissions import delete_objects, manage_zcatalog_indexes
 import Globals
 from OFS.Folder import Folder
 from OFS.FindSupport import FindSupport
@@ -25,7 +29,6 @@
 from Acquisition import Implicit
 from Persistence import Persistent
 from zLOG import LOG, ERROR
-
 from Products.PluginIndexes.common.PluggableIndex import PluggableIndexInterface
 
 _marker = []
@@ -37,39 +40,22 @@
     # The interfaces we want to show up in our object manager
     _product_interfaces = (PluggableIndexInterface, )
 
-    meta_type="ZCatalogIndex"
-#    icon="misc_/ZCatalog/www/index.gif"
-
-    manage_options = (
-        ObjectManager.manage_options +
-        Historical.manage_options +
-        SimpleItem.manage_options
-    )
+    meta_type = "ZCatalogIndex"
+    manage_options = ()
     
     security = ClassSecurityInfo()
-    security.declareObjectProtected('Manage ZCatalogIndex Entries')
-
-    manage_main = DTMLFile('dtml/manageIndex',globals())
+    
+    security.declareObjectProtected(manage_zcatalog_indexes)
+    security.setPermissionDefault(manage_zcatalog_indexes, ('Manager',))
+    security.declareProtected(manage_zcatalog_indexes, 'addIndexForm')
     addIndexForm= DTMLFile('dtml/addIndexForm',globals())
-
-    __ac_permissions__ = (
-
-        ('Manage ZCatalogIndex Entries',
-            ['manage_foobar',],
-
-            ['Manager']
-        ),
-
-        ('Search ZCatalogIndex',
-            ['searchResults', '__call__', 'all_meta_types',
-             'valid_roles', 'getobject'],
-
-            ['Anonymous', 'Manager']
-        ),
+    
+    # You no longer manage the Indexes here, they are managed from ZCatalog
+    def manage_main(self, REQUEST, RESPONSE):
+        """Redirect to the parent where the management screen now lives"""
+        RESPONSE.redirect('../manage_catalogIndexes')
         
-        ('Manage ZCatalogIndex Entries', ('',)),
-    )
-
+    manage_workspace = manage_main
 
     #
     # Object Manager methods
@@ -92,7 +78,8 @@
         indexes = self.aq_parent._catalog.indexes
         if default is _marker:  return indexes.get(id)
         return indexes.get(id, default)
-
+        
+    security.declareProtected(manage_zcatalog_indexes, 'objectIds')
     def objectIds(self, spec=None):
         
         indexes = self.aq_parent._catalog.indexes