def egov_reindexObjectSecurity(self, skip_self=False): if isFactoryContained(self): return at = getToolByName(self, TOOL_NAME, None) if at is None: return catalogs = [c for c in at.getCatalogsByType(self.meta_type) if ICatalogTool.providedBy(c)] path = "/".join(self.getPhysicalPath()) for catalog in catalogs: for brain in catalog.unrestrictedSearchResults(path=path): brain_path = brain.getPath() if brain_path == path and skip_self: continue # Get the object if hasattr(aq_base(brain), "_unrestrictedGetObject"): ob = brain._unrestrictedGetObject() else: # BBB: Zope 2.7 ob = self.unrestrictedTraverse(brain_path, None) if ob is None: # BBB: Ignore old references to deleted objects. # Can happen only in Zope 2.7, or when using # catalog-getObject-raises off in Zope 2.8 log("reindexObjectSecurity: Cannot get %s from catalog" % brain_path, level=WARNING) continue # Also append our new index indexes = list(self._cmf_security_indexes) indexes.append("get_local_roles") indexes.append("isLocalRoleAcquired") # Recatalog with the same catalog uid. catalog.reindexObject(ob, idxs=tuple(indexes), update_metadata=1, uid=brain_path)
def reindexObjectSecurity(self, skip_self=False): # Update security information in all registered catalogs. if isFactoryContained(self): return at = getToolByName(self, TOOL_NAME, None) if at is None: return catalogs = [c for c in at.getCatalogsByType(self.meta_type) if ICatalogTool.providedBy(c)] path = self.__url() for catalog in catalogs: for brain in catalog.unrestrictedSearchResults(path=path): brain_path = brain.getPath() if brain_path == path and skip_self: continue # Get the object if hasattr(aq_base(brain), '_unrestrictedGetObject'): try: ob = brain._unrestrictedGetObject() except (KeyError, AttributeError): ob = None if ob is None: log("reindexObjectSecurity: Cannot get %s from catalog" % brain_path, level=WARNING) continue # Recatalog with the same catalog uid. catalog.reindexObject(ob, idxs=self._cmf_security_indexes, update_metadata=0, uid=brain_path)
def reindexObjectSecurity(self, skip_self=False): """update security information in all registered catalogs. """ if isFactoryContained(self): return at = getToolByName(self, TOOL_NAME, None) if at is None: return catalogs = [c for c in at.getCatalogsByType(self.meta_type) if ICatalogTool.providedBy(c)] path = self.__url() for catalog in catalogs: for brain in catalog.unrestrictedSearchResults(path=path): brain_path = brain.getPath() if brain_path == path and skip_self: continue # Get the object if hasattr(aq_base(brain), '_unrestrictedGetObject'): try: ob = brain._unrestrictedGetObject() except (KeyError, AttributeError): ob = None if ob is None: log("reindexObjectSecurity: Cannot get %s from catalog" % brain_path, level=WARNING) continue # Recatalog with the same catalog uid. catalog.reindexObject(ob, idxs=self._cmf_security_indexes, update_metadata=0, uid=brain_path)
def permissionmanager_reindexObjectSecurity(self, skip_self=False): # Execute standard object reindexing. self._old_reindexObjectSecurity(skip_self=skip_self) # The standard indexing does not update catalog metadata. # We need to do that because we introduce security relevant # catalog metadata in this package. # In order to do that, we reindex the fast index "getId" of the # current context, so that we can use `update_metadata=True`. # We do not do that recursive because the metadata values # are non-recursive. if isFactoryContained(self): return at = getToolByName(self, TOOL_NAME, None) if at is None: return catalogs = [ catalog for catalog in at.getCatalogsByType(self.meta_type) if ICatalogTool.providedBy(catalog) ] for catalog in catalogs: catalog.reindexObject(self, idxs=['getId'], update_metadata=True)
def at_reindexObjectSecurity(self): if isFactoryContained(self): # pragma: no cover return at = getToolByName(self, TOOL_NAME, None) if at is None: # pragma: no cover return catalogs = [c for c in at.getCatalogsByType(self.meta_type) if ICatalogTool.providedBy(c)] for catalog in catalogs: _reindex(self, catalog)
def at_reindexObjectSecurity(self): if isFactoryContained(self): # pragma: no cover return at = getToolByName(self, TOOL_NAME, None) if at is None: # pragma: no cover return catalogs = [ c for c in at.getCatalogsByType(self.meta_type) if ICatalogTool.providedBy(c) ] for catalog in catalogs: _reindex(self, catalog)
def ftw_solr_CatalogMultiplex_reindexObjectSecurity(self, skip_self=False): """update security information in all registered catalogs. """ if isFactoryContained(self): return at = getToolByName(self, TOOL_NAME, None) if at is None: return catalogs = [c for c in at.getCatalogsByType(self.meta_type) if ICatalogTool.providedBy(c)] for catalog in catalogs: recursive_index_security(catalog, self)
def getCatalogsInSite(self): # Return a list of ids for objects implementing ZCatalog. portal = getToolByName(self, 'portal_url').getPortalObject() res = [] for object in portal.objectValues(): if ICatalogTool.providedBy(object): res.append(object.getId()) continue if IZCatalog.providedBy(object): res.append(object.getId()) continue res.sort() return res
def egov_reindexObjectSecurity(self, skip_self=False): if isFactoryContained(self): return at = getToolByName(self, TOOL_NAME, None) if at is None: return catalogs = [ c for c in at.getCatalogsByType(self.meta_type) if ICatalogTool.providedBy(c) ] path = '/'.join(self.getPhysicalPath()) for catalog in catalogs: for brain in catalog.unrestrictedSearchResults(path=path): brain_path = brain.getPath() if brain_path == path and skip_self: continue # Get the object if hasattr(aq_base(brain), '_unrestrictedGetObject'): ob = brain._unrestrictedGetObject() else: # BBB: Zope 2.7 ob = self.unrestrictedTraverse(brain_path, None) if ob is None: # BBB: Ignore old references to deleted objects. # Can happen only in Zope 2.7, or when using # catalog-getObject-raises off in Zope 2.8 log("reindexObjectSecurity: Cannot get %s from catalog" % brain_path, level=WARNING) continue # Also append our new index indexes = list(self._cmf_security_indexes) indexes.append('get_local_roles') indexes.append('isLocalRoleAcquired') # Recatalog with the same catalog uid. catalog.reindexObject(ob, idxs=tuple(indexes), update_metadata=1, uid=brain_path)
def reindexObjectSecurity(self, skip_self=False): """update security information in all registered catalogs. """ if isFactoryContained(self): return at = getToolByName(self, TOOL_NAME, None) if at is None: return catalogs = [ c for c in at.getCatalogsByType(self.meta_type) if ICatalogTool.providedBy(c) ] path = self.__url() for catalog in catalogs: for brain in catalog.unrestrictedSearchResults(path=path): brain_path = brain.getPath() if brain_path == path and skip_self: continue # Get the object if hasattr(aq_base(brain), '_unrestrictedGetObject'): ob = brain._unrestrictedGetObject() else: # BBB: Zope 2.7 ob = self.unrestrictedTraverse(brain_path, None) if ob is None: # BBB: Ignore old references to deleted objects. # Can happen only in Zope 2.7, or when using # catalog-getObject-raises off in Zope 2.8 log("reindexObjectSecurity: Cannot get %s from catalog" % brain_path, level=WARNING) continue # Recatalog with the same catalog uid. catalog.reindexObject(ob, idxs=self._cmf_security_indexes, update_metadata=0, uid=brain_path)
def reindexObjectSecurity(self, skip_self=False): """update security information in all registered catalogs. """ if isFactoryContained(self): return at = getToolByName(self, TOOL_NAME, None) if at is None: return catalogs = [c for c in at.getCatalogsByType(self.meta_type) if ICatalogTool.providedBy(c)] path = self.__url() for catalog in catalogs: for brain in catalog.unrestrictedSearchResults(path=path): brain_path = brain.getPath() if brain_path == path and skip_self: continue # Get the object if hasattr(aq_base(brain), '_unrestrictedGetObject'): ob = brain._unrestrictedGetObject() else: # BBB: Zope 2.7 ob = self.unrestrictedTraverse(brain_path, None) if ob is None: # BBB: Ignore old references to deleted objects. # Can happen only in Zope 2.7, or when using # catalog-getObject-raises off in Zope 2.8 log("reindexObjectSecurity: Cannot get %s from catalog" % brain_path, level=WARNING) continue # Recatalog with the same catalog uid. catalog.reindexObject(ob, idxs=self._cmf_security_indexes, update_metadata=0, uid=brain_path)
def testInterfaceIsAdapted(self): ICatalogTool.providedBy(ResearchDatabaseCatalog)