[Zope-Checkins] SVN: Zope/trunk/src/Products/ - import permissions from AccessControl.Permissions

Yvo Schubbe y.2009 at wcm-solutions.de
Sat Jul 4 06:29:02 EDT 2009


Log message for revision 101498:
  - import permissions from AccessControl.Permissions

Changed:
  U   Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py
  U   Zope/trunk/src/Products/ZCTextIndex/ZCTextIndex.py

-=-
Modified: Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py
===================================================================
--- Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py	2009-07-04 10:28:34 UTC (rev 101497)
+++ Zope/trunk/src/Products/PluginIndexes/DateRangeIndex/DateRangeIndex.py	2009-07-04 10:29:02 UTC (rev 101498)
@@ -17,6 +17,8 @@
 
 import os
 
+from AccessControl.Permissions import manage_zcatalog_indexes
+from AccessControl.Permissions import view
 from AccessControl.SecurityInfo import ClassSecurityInfo
 from App.class_init import InitializeClass
 from App.Common import package_home
@@ -38,10 +40,7 @@
 
 _dtmldir = os.path.join( package_home( globals() ), 'dtml' )
 
-VIEW_PERMISSION         = 'View'
-INDEX_MGMT_PERMISSION   = 'Manage ZCatalogIndex Entries'
 
-
 class DateRangeIndex(UnIndex):
 
     """Index for date ranges, such as the "effective-expiration" range in CMF.
@@ -88,13 +87,13 @@
         self._edit(since_field, until_field)
         self.clear()
 
-    security.declareProtected(VIEW_PERMISSION, 'getSinceField')
+    security.declareProtected(view, 'getSinceField')
     def getSinceField(self):
         """Get the name of the attribute indexed as start date.
         """
         return self._since_field
 
-    security.declareProtected(VIEW_PERMISSION, 'getUntilField')
+    security.declareProtected(view, 'getUntilField')
     def getUntilField(self):
         """Get the name of the attribute indexed as end date.
         """
@@ -102,7 +101,7 @@
 
     manage_indexProperties = DTMLFile( 'manageDateRangeIndex', _dtmldir )
 
-    security.declareProtected(INDEX_MGMT_PERMISSION, 'manage_edit')
+    security.declareProtected(manage_zcatalog_indexes, 'manage_edit')
     def manage_edit( self, since_field, until_field, REQUEST ):
         """
         """
@@ -120,7 +119,7 @@
         self._since_field = since_field
         self._until_field = until_field
 
-    security.declareProtected(INDEX_MGMT_PERMISSION, 'clear')
+    security.declareProtected(manage_zcatalog_indexes, 'clear')
     def clear( self ):
         """
             Start over fresh.
@@ -303,7 +302,7 @@
     #
     #   ZCatalog needs this, although it isn't (yet) part of the interface.
     #
-    security.declareProtected(VIEW_PERMISSION , 'numObjects')
+    security.declareProtected(view , 'numObjects')
     def numObjects( self ):
         """ """
         return len( self._unindex )

Modified: Zope/trunk/src/Products/ZCTextIndex/ZCTextIndex.py
===================================================================
--- Zope/trunk/src/Products/ZCTextIndex/ZCTextIndex.py	2009-07-04 10:28:34 UTC (rev 101497)
+++ Zope/trunk/src/Products/ZCTextIndex/ZCTextIndex.py	2009-07-04 10:29:02 UTC (rev 101498)
@@ -18,9 +18,11 @@
 
 from cgi import escape
 
-from AccessControl.SecurityInfo import ClassSecurityInfo
+from AccessControl.Permissions import manage_vocabulary
 from AccessControl.Permissions import manage_zcatalog_indexes
+from AccessControl.Permissions import query_vocabulary
 from AccessControl.Permissions import search_zcatalog
+from AccessControl.SecurityInfo import ClassSecurityInfo
 from Acquisition import aq_base
 from Acquisition import aq_inner
 from Acquisition import aq_parent
@@ -316,8 +318,8 @@
 
 # I am borrowing the existing vocabulary permissions for now to avoid
 # adding new permissions. This may change when old style Vocabs go away
-LexiconQueryPerm = 'Query Vocabulary'
-LexiconMgmtPerm = 'Manage Vocabulary'
+LexiconQueryPerm = query_vocabulary
+LexiconMgmtPerm = manage_vocabulary
 
 
 class PLexicon(Lexicon, Implicit, SimpleItem):



More information about the Zope-Checkins mailing list