Commit c4886de0 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

ZSQLCatalog: cleanup duplicate security declarations.

parent 8316dcce
...@@ -23,7 +23,7 @@ from thread import allocate_lock, get_ident ...@@ -23,7 +23,7 @@ from thread import allocate_lock, get_ident
from OFS.Folder import Folder from OFS.Folder import Folder
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from AccessControl.Permissions import access_contents_information, \ from AccessControl.Permissions import access_contents_information, \
manage_zcatalog_entries import_export_objects, manage_zcatalog_entries
from AccessControl.SimpleObjectPolicies import ContainerAssertions from AccessControl.SimpleObjectPolicies import ContainerAssertions
from BTrees.OIBTree import OIBTree from BTrees.OIBTree import OIBTree
from App.config import getConfiguration from App.config import getConfiguration
...@@ -357,17 +357,10 @@ class Catalog(Folder, ...@@ -357,17 +357,10 @@ class Catalog(Folder,
__ac_permissions__= ( __ac_permissions__= (
('Manage ZCatalog Entries', ('Manage ZCatalog Entries',
['manage_catalogObject', 'manage_uncatalogObject', ['manage_catalogView', 'manage_catalogFind',
'manage_catalogView', 'manage_catalogFind',
'manage_catalogFilter', 'manage_catalogFilter',
'manage_catalogAdvanced', 'manage_catalogAdvanced',
'manage_main',],
'manage_catalogReindex', 'manage_catalogFoundItems',
'manage_catalogClear',
'manage_main',
'manage_editFilter',
],
['Manager']), ['Manager']),
('Search ZCatalog', ('Search ZCatalog',
...@@ -377,10 +370,6 @@ class Catalog(Folder, ...@@ -377,10 +370,6 @@ class Catalog(Folder,
'getFilterableMethodList',], 'getFilterableMethodList',],
['Anonymous', 'Manager']), ['Anonymous', 'Manager']),
('Import/Export objects',
['manage_exportProperties', 'manage_importProperties', ],
['Manager']),
) )
_properties = ( _properties = (
...@@ -714,7 +703,7 @@ class Catalog(Folder, ...@@ -714,7 +703,7 @@ class Catalog(Folder,
local_role_key_dict[role.strip()] = column.strip() local_role_key_dict[role.strip()] = column.strip()
return local_role_key_dict.items() return local_role_key_dict.items()
security.declareProtected(manage_zcatalog_entries, 'manage_exportProperties') security.declareProtected(import_export_objects, 'manage_exportProperties')
def manage_exportProperties(self, REQUEST=None, RESPONSE=None): def manage_exportProperties(self, REQUEST=None, RESPONSE=None):
""" """
Export properties to an XML file. Export properties to an XML file.
...@@ -774,7 +763,7 @@ class Catalog(Folder, ...@@ -774,7 +763,7 @@ class Catalog(Folder,
'inline;filename=properties.xml') 'inline;filename=properties.xml')
return f.getvalue() return f.getvalue()
security.declareProtected(manage_zcatalog_entries, 'manage_importProperties') security.declareProtected(import_export_objects, 'manage_importProperties')
def manage_importProperties(self, file): def manage_importProperties(self, file):
""" """
Import properties from an XML file. Import properties from an XML file.
......
...@@ -24,7 +24,8 @@ from Persistence import Persistent ...@@ -24,7 +24,8 @@ from Persistence import Persistent
from DocumentTemplate.DT_Util import InstanceDict, TemplateDict from DocumentTemplate.DT_Util import InstanceDict, TemplateDict
from DocumentTemplate.DT_Util import Eval from DocumentTemplate.DT_Util import Eval
from AccessControl.Permission import name_trans from AccessControl.Permission import name_trans
from AccessControl.Permissions import manage_zcatalog_entries from AccessControl.Permissions import import_export_objects, \
manage_zcatalog_entries
from SQLCatalog import CatalogError from SQLCatalog import CatalogError
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from DocumentTemplate.security import RestrictedDTML from DocumentTemplate.security import RestrictedDTML
...@@ -121,22 +122,11 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -121,22 +122,11 @@ class ZCatalog(Folder, Persistent, Implicit):
__ac_permissions__=( __ac_permissions__=(
('Manage ZCatalog Entries', ('Manage ZCatalog Entries',
['manage_catalogObject', 'manage_uncatalogObject', ['manage_catalogView', 'manage_catalogFind',
'catalog_object', 'uncatalog_object', 'refreshCatalog',
'manage_catalogView', 'manage_catalogFind',
'manage_catalogSchema', 'manage_catalogFilter', 'manage_catalogSchema', 'manage_catalogFilter',
'manage_catalogAdvanced', 'manage_objectInformation', 'manage_catalogAdvanced', 'manage_objectInformation',
'manage_catalogHotReindexing', 'manage_catalogHotReindexing',
'manage_main',],
'manage_catalogReindex', 'manage_catalogFoundItems',
'manage_catalogClear', 'manage_editSchema',
'manage_main',
'manage_editFilter',
'manage_hotReindexAll',
],
['Manager']), ['Manager']),
('Search ZCatalog', ('Search ZCatalog',
...@@ -147,10 +137,6 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -147,10 +137,6 @@ class ZCatalog(Folder, Persistent, Implicit):
'getCatalogSearchResultKeys', 'getFilterableMethodList', ], 'getCatalogSearchResultKeys', 'getFilterableMethodList', ],
['Anonymous', 'Manager']), ['Anonymous', 'Manager']),
('Import/Export objects',
['manage_catalogExportProperties', 'manage_catalogImportProperties', ],
['Manager']),
) )
_properties = ( _properties = (
...@@ -227,7 +213,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -227,7 +213,7 @@ class ZCatalog(Folder, Persistent, Implicit):
return self._getOb(id, default_value) return self._getOb(id, default_value)
security.declareProtected(manage_zcatalog_entries, 'manage_catalogExportProperties') security.declareProtected(import_export_objects, 'manage_catalogExportProperties')
def manage_catalogExportProperties(self, REQUEST=None, RESPONSE=None, sql_catalog_id=None): def manage_catalogExportProperties(self, REQUEST=None, RESPONSE=None, sql_catalog_id=None):
""" """
Export properties to an XML file. Export properties to an XML file.
...@@ -236,7 +222,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -236,7 +222,7 @@ class ZCatalog(Folder, Persistent, Implicit):
if catalog is not None: if catalog is not None:
return catalog.manage_exportProperties(REQUEST=REQUEST, RESPONSE=RESPONSE) return catalog.manage_exportProperties(REQUEST=REQUEST, RESPONSE=RESPONSE)
security.declareProtected(manage_zcatalog_entries, 'manage_catalogImportProperties') security.declareProtected(import_export_objects, 'manage_catalogImportProperties')
def manage_catalogImportProperties(self, file, sql_catalog_id=None): def manage_catalogImportProperties(self, file, sql_catalog_id=None):
""" """
Import properties from an XML file. Import properties from an XML file.
...@@ -592,7 +578,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -592,7 +578,7 @@ class ZCatalog(Folder, Persistent, Implicit):
if catalog is not None: if catalog is not None:
catalog.manage_catalogReindex(REQUEST, RESPONSE, URL1, urls=urls) catalog.manage_catalogReindex(REQUEST, RESPONSE, URL1, urls=urls)
security.declarePrivate('refreshCatalog') security.declareProtected(manage_zcatalog_entries, 'refreshCatalog')
def refreshCatalog(self, clear=0, sql_catalog_id=None): def refreshCatalog(self, clear=0, sql_catalog_id=None):
""" re-index everything we can find """ """ re-index everything we can find """
...@@ -716,7 +702,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -716,7 +702,7 @@ class ZCatalog(Folder, Persistent, Implicit):
#LOG('ZSQLCatalog wrapObject', 0, 'object = %r, kw = %r' % (object, kw)) #LOG('ZSQLCatalog wrapObject', 0, 'object = %r, kw = %r' % (object, kw))
return object return object
security.declarePrivate('catalog_object') security.declareProtected(manage_zcatalog_entries, 'catalog_object')
def catalog_object(self, obj, url=None, idxs=[], is_object_moved=0, sql_catalog_id=None, **kw): def catalog_object(self, obj, url=None, idxs=[], is_object_moved=0, sql_catalog_id=None, **kw):
""" wrapper around catalog """ """ wrapper around catalog """
self.catalogObjectList([obj], sql_catalog_id=sql_catalog_id) self.catalogObjectList([obj], sql_catalog_id=sql_catalog_id)
...@@ -866,7 +852,7 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -866,7 +852,7 @@ class ZCatalog(Folder, Persistent, Implicit):
object_list[:] = failed_object_list object_list[:] = failed_object_list
security.declarePrivate('uncatalog_object') security.declareProtected(manage_zcatalog_entries, 'uncatalog_object')
def uncatalog_object(self, uid=None,path=None, sql_catalog_id=None): def uncatalog_object(self, uid=None,path=None, sql_catalog_id=None):
""" wrapper around catalog """ """ wrapper around catalog """
if uid is None: if uid is None:
......
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