Skip to content

Commit

Permalink
Small refactor of new getIndexObjects method. Tightened security (sin…
Browse files Browse the repository at this point in the history
…ce wrapped indexes are more open to untrusted code) and generalized the other assertions for ZCat.
  • Loading branch information
caseman committed Aug 15, 2002
1 parent 4ccbdc2 commit 8b12bbb
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions ZCatalog.py
Expand Up @@ -27,6 +27,8 @@
from Catalog import Catalog, CatalogError
from AccessControl import getSecurityManager
from AccessControl.DTML import RestrictedDTML
from AccessControl.Permissions import \
manage_zcatalog_entries, manage_zcatalog_indexes, search_zcatalog
from zLOG import LOG, ERROR
from ZCatalogIndexes import ZCatalogIndexes
from Products.PluginIndexes.common.PluggableIndex \
Expand Down Expand Up @@ -113,7 +115,7 @@ class is that it is not Zope specific. You can use it in any

__ac_permissions__=(

('Manage ZCatalog Entries',
(manage_zcatalog_entries,
['manage_catalogObject', 'manage_uncatalogObject',
'catalog_object', 'uncatalog_object', 'refreshCatalog',

Expand All @@ -131,12 +133,16 @@ class is that it is not Zope specific. You can use it in any
],
['Manager']),

('Search ZCatalog',
(search_zcatalog,
['searchResults', '__call__', 'uniqueValuesFor',
'getpath', 'schema', 'indexes', 'index_objects', 'getIndexObjects'
'getpath', 'schema', 'indexes', 'index_objects',
'all_meta_types', 'valid_roles', 'resolve_url',
'getobject'],
['Anonymous', 'Manager']),

(manage_zcatalog_indexes,
['getIndexObjects'],
['Manager']),
)


Expand Down Expand Up @@ -440,7 +446,7 @@ def manage_clearIndex(self, ids=None, REQUEST=None, RESPONSE=None,
'/manage_catalogIndexes?manage_tabs_message=Index%20Cleared')


def reindexIndex(self,name,REQUEST):
def reindexIndex(self, name, REQUEST):
paths = self._catalog.uids.keys()

for p in paths:
Expand Down Expand Up @@ -568,8 +574,8 @@ def index_objects(self):

def getIndexObjects(self):
# Return a list of wrapped(!) indexes
catalog = self._catalog
return [index.__of__(catalog) for index in catalog.indexes.values()]
getIndex = self._catalog.getIndex
return [getIndex(name) for name in self.indexes()]

def _searchable_arguments(self):
r = {}
Expand Down

0 comments on commit 8b12bbb

Please sign in to comment.