From 2f628f841a9129927f6d5e372157c2b041312f6c Mon Sep 17 00:00:00 2001 From: Roman Kysil Date: Tue, 10 Jun 2025 16:29:04 +0200 Subject: [PATCH 1/2] crator criteria porting --- CHANGES.rst | 8 +++--- src/redturtle/volto/configure.zcml | 1 + .../volto/profiles/default/metadata.xml | 2 +- .../profiles/default/registry/criteria.xml | 28 +++++++++++-------- src/redturtle/volto/upgrades.py | 11 ++++++++ src/redturtle/volto/upgrades.zcml | 8 ++++++ src/redturtle/volto/vocabularies/__init__.py | 0 .../volto/vocabularies/configure.zcml | 14 ++++++++++ .../volto/vocabularies/principals.py | 11 ++++++++ 9 files changed, 66 insertions(+), 17 deletions(-) create mode 100644 src/redturtle/volto/vocabularies/__init__.py create mode 100644 src/redturtle/volto/vocabularies/configure.zcml create mode 100644 src/redturtle/volto/vocabularies/principals.py diff --git a/CHANGES.rst b/CHANGES.rst index b8c7ad03..e6e15b2e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,8 +4,8 @@ Changelog 5.5.13 (unreleased) ------------------- -- Nothing changed yet. - +- Use custom creator criteria to list only creators present in the catalog to avoid an empty list when using LDAP and many_users flag + [folix-01] 5.5.12 (2025-07-02) ------------------- @@ -33,7 +33,7 @@ Changelog [mamico] - Fix issue with event search in @querystring-search override: converting a timezone-aware DateTime to utcdatetime causes a problem when searching for - "today", as it shifts start=day x at 00:00 to start=day x-1 at 22:00 in GMT+2 timezone. + "today", as it shifts start=day x at 00:00 to start=day x-1 at 22:00 in GMT+2 timezone. [lucabel] @@ -116,7 +116,7 @@ Changelog - Add dependency with collective.volto.sitesettings. [cekk] - + 5.4.9 (2024-04-22) ------------------ diff --git a/src/redturtle/volto/configure.zcml b/src/redturtle/volto/configure.zcml index af4992ce..8056e5c6 100644 --- a/src/redturtle/volto/configure.zcml +++ b/src/redturtle/volto/configure.zcml @@ -13,6 +13,7 @@ + diff --git a/src/redturtle/volto/profiles/default/metadata.xml b/src/redturtle/volto/profiles/default/metadata.xml index c3906f0b..6f079ea3 100644 --- a/src/redturtle/volto/profiles/default/metadata.xml +++ b/src/redturtle/volto/profiles/default/metadata.xml @@ -1,6 +1,6 @@ - 4308 + 4309 profile-plone.volto:default profile-plone.app.caching:with-caching-proxy diff --git a/src/redturtle/volto/profiles/default/registry/criteria.xml b/src/redturtle/volto/profiles/default/registry/criteria.xml index 327be94e..eed45831 100644 --- a/src/redturtle/volto/profiles/default/registry/criteria.xml +++ b/src/redturtle/volto/profiles/default/registry/criteria.xml @@ -4,17 +4,21 @@ i18n:domain="redturtle.volto"> - - Show elements excluded from navigation - Select False to show only elements not excluded from navigation. - True - False - - plone.app.querystring.operation.boolean.isTrue - plone.app.querystring.operation.boolean.isFalse - - Metadata - + + Show elements excluded from navigation + Select False to show only elements not excluded from navigation. + True + False + + plone.app.querystring.operation.boolean.isTrue + plone.app.querystring.operation.boolean.isFalse + + Metadata + + + + redturtle.volto.vocabularies.Creators + diff --git a/src/redturtle/volto/upgrades.py b/src/redturtle/volto/upgrades.py index 28620d89..4ba63dfe 100644 --- a/src/redturtle/volto/upgrades.py +++ b/src/redturtle/volto/upgrades.py @@ -2,11 +2,14 @@ from Acquisition import aq_base from copy import deepcopy from plone import api +from plone.app.querystring.interfaces import IQueryField from plone.app.upgrade.utils import installOrReinstallProduct from plone.dexterity.utils import iterSchemata +from plone.registry.interfaces import IRegistry from plone.restapi.behaviors import IBlocks from redturtle.volto.setuphandlers import remove_custom_googlebot from uuid import uuid4 +from zope.component import getUtility from zope.schema import getFields @@ -594,3 +597,11 @@ def should_reindex(blocks): logger.info(f"Reindex complete. Reindexed {len(reindexed)} contents:") for url in reindexed: logger.info(f"- {url}") + + +def to_4409(context): + registry = getUtility(IRegistry) + settings = registry.forInterface( + IQueryField, prefix="plone.app.querystring.field.Creator" + ) + settings.vocabulary = "redturtle.volto.vocabularies.Creators" diff --git a/src/redturtle/volto/upgrades.zcml b/src/redturtle/volto/upgrades.zcml index 79c501d4..2fa6bff3 100644 --- a/src/redturtle/volto/upgrades.zcml +++ b/src/redturtle/volto/upgrades.zcml @@ -256,4 +256,12 @@ destination="4308" handler=".upgrades.to_4308" /> + diff --git a/src/redturtle/volto/vocabularies/__init__.py b/src/redturtle/volto/vocabularies/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/redturtle/volto/vocabularies/configure.zcml b/src/redturtle/volto/vocabularies/configure.zcml new file mode 100644 index 00000000..99b4d662 --- /dev/null +++ b/src/redturtle/volto/vocabularies/configure.zcml @@ -0,0 +1,14 @@ + + + + + diff --git a/src/redturtle/volto/vocabularies/principals.py b/src/redturtle/volto/vocabularies/principals.py new file mode 100644 index 00000000..91f0ad79 --- /dev/null +++ b/src/redturtle/volto/vocabularies/principals.py @@ -0,0 +1,11 @@ +from plone.app.vocabularies.catalog import KeywordsVocabulary +from zope.interface import implementer +from zope.schema.interfaces import IVocabularyFactory + + +@implementer(IVocabularyFactory) +class CreatorsVocabulary(KeywordsVocabulary): + keyword_index = "Creator" + + +CreatorsVocabularyFactory = CreatorsVocabulary() From 202d237a53b62567e4baaabeab05fc2382d5391d Mon Sep 17 00:00:00 2001 From: Roman Kysil Date: Wed, 30 Jul 2025 16:36:08 +0200 Subject: [PATCH 2/2] fix upgrade --- src/redturtle/volto/upgrades.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/redturtle/volto/upgrades.py b/src/redturtle/volto/upgrades.py index 4ba63dfe..66170daa 100644 --- a/src/redturtle/volto/upgrades.py +++ b/src/redturtle/volto/upgrades.py @@ -599,7 +599,7 @@ def should_reindex(blocks): logger.info(f"- {url}") -def to_4409(context): +def to_4309(context): registry = getUtility(IRegistry) settings = registry.forInterface( IQueryField, prefix="plone.app.querystring.field.Creator"