Skip to content

Commit

Permalink
ZCatalog Fixup:
Browse files Browse the repository at this point in the history
  * 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.
  • Loading branch information
caseman committed Jun 28, 2002
1 parent b427bee commit c6d348f
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 349 deletions.
16 changes: 8 additions & 8 deletions ZCatalog.py
Expand Up @@ -85,7 +85,7 @@ class is that it is not Zope specific. You can use it in any
'action': 'manage_propertiesForm',
'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',
Expand Down Expand Up @@ -347,7 +347,7 @@ def manage_addIndex(self, name, type, extra=None,REQUEST=None, RESPONSE=None, UR
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,
Expand All @@ -371,7 +371,7 @@ def manage_delIndex(self, ids=None, REQUEST=None, RESPONSE=None,
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,)
Expand All @@ -380,7 +380,7 @@ def manage_delIndex(self, ids=None, REQUEST=None, RESPONSE=None,
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,
Expand All @@ -389,7 +389,7 @@ def manage_clearIndex(self, ids=None, REQUEST=None, RESPONSE=None,
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,)
Expand All @@ -398,7 +398,7 @@ def manage_clearIndex(self, ids=None, REQUEST=None, RESPONSE=None,
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):
Expand All @@ -418,7 +418,7 @@ def manage_reindexIndex(self, ids=None, REQUEST=None, RESPONSE=None, URL1=None):
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,)
Expand All @@ -427,7 +427,7 @@ def manage_reindexIndex(self, ids=None, REQUEST=None, RESPONSE=None, URL1=None):
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):
Expand Down
49 changes: 18 additions & 31 deletions ZCatalogIndexes.py
Expand Up @@ -11,8 +11,12 @@
#
##############################################################################

"""$Id: ZCatalogIndexes.py,v 1.7 2002/06/28 17:25:23 caseman Exp $
"""

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
Expand All @@ -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 = []
Expand All @@ -37,39 +40,22 @@ class ZCatalogIndexes (IFAwareObjectManager, Folder, Persistent, Implicit):
# 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
Expand All @@ -92,7 +78,8 @@ def _getOb(self, id, default=_marker):
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
Expand Down

0 comments on commit c6d348f

Please sign in to comment.