Commit 0152e9d8 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Catalog: Require ERP5Site_filterUserIdSet when catalog role columns are present

This ensures catalog can be rebuilt from scratch.
parent 166b7b15
......@@ -852,30 +852,6 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
"""
return ZCatalog.countResults(self, REQUEST, **kw)
def _filterUserIdSet(id_set):
"""
This is the historical implementation answering the need to sort out
which identifiers are actual users, the others being assumed to be
security groups.
The issue with this approach is that searchUsers, when involving
ERP5 user plugins, relies on the catalog. Which means that if a user
document (ex: Person) grants a local role to its user, the first
indexation will be unable to find that user through searchUsers, and
hence will assume it is a security group. In turn, this means that
role-specific catalog columns cannot be used for this role on such
document, causing a security uid to be allocated. On second
reindexation, the user will be properly identified as a user, but
security uids are never de-allocated and so the cost of having that
extra entry around (longer list of possible values applying to
security_uid column) will persist.
"""
return (
x['id'] for x in self.getPortalObject().acl_users.searchUsers(
id=list(id_set),
exact_match=True,
)
)
def wrapObjectList(self, object_value_list, catalog_value):
"""
Return a list of wrapped objects for reindexing.
......@@ -917,13 +893,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
# Note: we mutate the set, so all related wrappers get (purposedly)
# affected by this, which must happen before _getSecurityParameterList
# is called (which happens when calling getSecurityUidDict below).
user_set.update(
getattr(
self,
'ERP5Site_filterUserIdSet',
self._filterUserIdSet,
)(security_group_set),
)
user_set.update(self.ERP5Site_filterUserIdSet(security_group_set))
getSecurityUidDict = catalog_value.getSecurityUidDict
getSubjectSetUid = catalog_value.getSubjectSetUid
......
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