Commit 522da1c2 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Type: Disallow restricted python from calling immediate reindexation methods

Calling these can break catalog by not caring about concurrent indexation
activities. Even non-restricted code should not call these, but:
- they cannot be reliably renamed, as there exist activity dependencies
  looking for these exact names (which is a bad practice on its own)
- there is no simple access control mechanism for non-restricted code
So rely on developer discipline instead.
parent 35e31f67
...@@ -2788,13 +2788,13 @@ class Base( CopyContainer, ...@@ -2788,13 +2788,13 @@ class Base( CopyContainer,
# def contentIds(self, *args, **kw): # def contentIds(self, *args, **kw):
# return [] # return []
security.declarePublic('immediateReindexObject') security.declarePrivate('immediateReindexObject')
def immediateReindexObject(self, *args, **kw): def immediateReindexObject(self, *args, **kw):
if self.isIndexable and int(getattr(self.getPortalObject(), 'isIndexable', 1)): if self.isIndexable and int(getattr(self.getPortalObject(), 'isIndexable', 1)):
with super_user(): with super_user():
PortalContent.reindexObject(self, *args, **kw) PortalContent.reindexObject(self, *args, **kw)
security.declarePublic('recursiveImmediateReindexObject') security.declarePrivate('recursiveImmediateReindexObject')
recursiveImmediateReindexObject = immediateReindexObject recursiveImmediateReindexObject = immediateReindexObject
security.declarePublic('reindexObject') security.declarePublic('reindexObject')
......
...@@ -1366,7 +1366,7 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn): ...@@ -1366,7 +1366,7 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn):
value_list.extend(c.getIndexableChildValueList()) value_list.extend(c.getIndexableChildValueList())
return value_list return value_list
security.declarePublic( 'recursiveImmediateReindexObject' ) security.declarePrivate('recursiveImmediateReindexObject')
def recursiveImmediateReindexObject(self, **kw): def recursiveImmediateReindexObject(self, **kw):
if self.isIndexable and int(getattr(self.getPortalObject(), 'isIndexable', 1)): if self.isIndexable and int(getattr(self.getPortalObject(), 'isIndexable', 1)):
self.immediateReindexObject(**kw) self.immediateReindexObject(**kw)
......
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