Commit ab919171 authored by 's avatar

- import permissions from AccessControl.Permissions

parent cb45cbcc
...@@ -17,6 +17,8 @@ $Id$ ...@@ -17,6 +17,8 @@ $Id$
import os import os
from AccessControl.Permissions import manage_zcatalog_indexes
from AccessControl.Permissions import view
from AccessControl.SecurityInfo import ClassSecurityInfo from AccessControl.SecurityInfo import ClassSecurityInfo
from App.class_init import InitializeClass from App.class_init import InitializeClass
from App.Common import package_home from App.Common import package_home
...@@ -38,9 +40,6 @@ from Products.PluginIndexes.interfaces import IDateRangeIndex ...@@ -38,9 +40,6 @@ from Products.PluginIndexes.interfaces import IDateRangeIndex
_dtmldir = os.path.join( package_home( globals() ), 'dtml' ) _dtmldir = os.path.join( package_home( globals() ), 'dtml' )
VIEW_PERMISSION = 'View'
INDEX_MGMT_PERMISSION = 'Manage ZCatalogIndex Entries'
class DateRangeIndex(UnIndex): class DateRangeIndex(UnIndex):
...@@ -88,13 +87,13 @@ class DateRangeIndex(UnIndex): ...@@ -88,13 +87,13 @@ class DateRangeIndex(UnIndex):
self._edit(since_field, until_field) self._edit(since_field, until_field)
self.clear() self.clear()
security.declareProtected(VIEW_PERMISSION, 'getSinceField') security.declareProtected(view, 'getSinceField')
def getSinceField(self): def getSinceField(self):
"""Get the name of the attribute indexed as start date. """Get the name of the attribute indexed as start date.
""" """
return self._since_field return self._since_field
security.declareProtected(VIEW_PERMISSION, 'getUntilField') security.declareProtected(view, 'getUntilField')
def getUntilField(self): def getUntilField(self):
"""Get the name of the attribute indexed as end date. """Get the name of the attribute indexed as end date.
""" """
...@@ -102,7 +101,7 @@ class DateRangeIndex(UnIndex): ...@@ -102,7 +101,7 @@ class DateRangeIndex(UnIndex):
manage_indexProperties = DTMLFile( 'manageDateRangeIndex', _dtmldir ) 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 ): def manage_edit( self, since_field, until_field, REQUEST ):
""" """
""" """
...@@ -120,7 +119,7 @@ class DateRangeIndex(UnIndex): ...@@ -120,7 +119,7 @@ class DateRangeIndex(UnIndex):
self._since_field = since_field self._since_field = since_field
self._until_field = until_field self._until_field = until_field
security.declareProtected(INDEX_MGMT_PERMISSION, 'clear') security.declareProtected(manage_zcatalog_indexes, 'clear')
def clear( self ): def clear( self ):
""" """
Start over fresh. Start over fresh.
...@@ -303,7 +302,7 @@ class DateRangeIndex(UnIndex): ...@@ -303,7 +302,7 @@ class DateRangeIndex(UnIndex):
# #
# ZCatalog needs this, although it isn't (yet) part of the interface. # ZCatalog needs this, although it isn't (yet) part of the interface.
# #
security.declareProtected(VIEW_PERMISSION , 'numObjects') security.declareProtected(view , 'numObjects')
def numObjects( self ): def numObjects( self ):
""" """ """ """
return len( self._unindex ) return len( self._unindex )
......
...@@ -18,9 +18,11 @@ $Id$ ...@@ -18,9 +18,11 @@ $Id$
from cgi import escape 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 manage_zcatalog_indexes
from AccessControl.Permissions import query_vocabulary
from AccessControl.Permissions import search_zcatalog from AccessControl.Permissions import search_zcatalog
from AccessControl.SecurityInfo import ClassSecurityInfo
from Acquisition import aq_base from Acquisition import aq_base
from Acquisition import aq_inner from Acquisition import aq_inner
from Acquisition import aq_parent from Acquisition import aq_parent
...@@ -316,8 +318,8 @@ def manage_addLexicon(self, id, title='', elements=[], REQUEST=None): ...@@ -316,8 +318,8 @@ def manage_addLexicon(self, id, title='', elements=[], REQUEST=None):
# I am borrowing the existing vocabulary permissions for now to avoid # I am borrowing the existing vocabulary permissions for now to avoid
# adding new permissions. This may change when old style Vocabs go away # adding new permissions. This may change when old style Vocabs go away
LexiconQueryPerm = 'Query Vocabulary' LexiconQueryPerm = query_vocabulary
LexiconMgmtPerm = 'Manage Vocabulary' LexiconMgmtPerm = manage_vocabulary
class PLexicon(Lexicon, Implicit, SimpleItem): class PLexicon(Lexicon, Implicit, SimpleItem):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment