During the clear in SQLCatalog, not create of 'reserved' element if there is a portal ids

In hot reindexing during the 'double indexing' step, update the security
of object in the destination catalog too


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32501 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1f339626
...@@ -728,6 +728,18 @@ class Catalog(Folder, ...@@ -728,6 +728,18 @@ class Catalog(Folder,
def getSecurityUid(self, wrapped_object): def getSecurityUid(self, wrapped_object):
""" """
Cache a uid for each security permission Cache a uid for each security permission
Return a tuple with a security uid (string) and a new tuple content the
roles and users if not exist already.
With the roles of object, search the security_uid associate in the
catalog_innodb:
- if the security not exist a security uid is generated with id_tool
or security_uid_index property and
return the new security_uid and the tuple contains the new roles
to add the roles in roles_and_user table of the database.
- if the security exist the security uid is returned and the second
element is None for not recreate the security in roles_and_user
table of the database.
We try to create a unique security (to reduce number of lines) We try to create a unique security (to reduce number of lines)
and to assign security only to root document and to assign security only to root document
...@@ -797,6 +809,8 @@ class Catalog(Folder, ...@@ -797,6 +809,8 @@ class Catalog(Folder,
# Reserved uids have been removed. # Reserved uids have been removed.
self.clearReserved() self.clearReserved()
id_tool = getattr(self.getPortalObject(), 'portal_ids', None)
if id_tool is None:
# Add a dummy item so that SQLCatalog will not use existing uids again. # Add a dummy item so that SQLCatalog will not use existing uids again.
self.insertMaxUid() self.insertMaxUid()
......
...@@ -393,6 +393,8 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -393,6 +393,8 @@ class ZCatalog(Folder, Persistent, Implicit):
""" """
if self.default_sql_catalog_id == source_sql_catalog_id: if self.default_sql_catalog_id == source_sql_catalog_id:
self.default_sql_catalog_id = destination_sql_catalog_id self.default_sql_catalog_id = destination_sql_catalog_id
id_tool = getattr(self.getPortalObject(), 'portal_ids', None)
if id_tool is None:
# Insert the latest generated uid. # Insert the latest generated uid.
# This must be done just before swaping the catalogs in case there were # This must be done just before swaping the catalogs in case there were
# generated uids since destination catalog was created. # generated uids since destination catalog was created.
...@@ -836,8 +838,12 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -836,8 +838,12 @@ class ZCatalog(Folder, Persistent, Implicit):
if self.hot_reindexing_state == HOT_REINDEXING_RECORDING_STATE: if self.hot_reindexing_state == HOT_REINDEXING_RECORDING_STATE:
destination_catalog.recordObjectList(url_list, 1) destination_catalog.recordObjectList(url_list, 1)
else: else:
if wrapped_object_list: wrapped_destination_object_list = []
destination_catalog.catalogObjectList(wrapped_object_list,**kw) for obj in object_list:
wrap_obj = self.wrapObject(obj, sql_catalog_id=self.destination_sql_catalog_id)
wrapped_destination_object_list.append(wrap_obj)
if wrapped_destination_object_list:
destination_catalog.catalogObjectList(wrapped_destination_object_list,**kw)
object_list[:] = failed_object_list object_list[:] = failed_object_list
......
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