From 5e488de090a3e9db3f59d84d6ab24f538ac6e8e3 Mon Sep 17 00:00:00 2001 From: jimbiscuit Date: Tue, 26 Nov 2024 09:27:50 +0100 Subject: [PATCH 1/2] SUP-40874. Fix frozen_suspension state (#291) --- news/SUP-39511.bugfix | 2 ++ src/Products/urban/migration/update_codt_2024.py | 14 ++++++++++++++ src/Products/urban/migration/upgrades.zcml | 9 +++++++++ src/Products/urban/profiles/default/metadata.xml | 2 +- .../urban/workflows/codt_licence_workflow.py | 15 +++++++++++++++ 5 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 news/SUP-39511.bugfix diff --git a/news/SUP-39511.bugfix b/news/SUP-39511.bugfix new file mode 100644 index 000000000..4e0c05180 --- /dev/null +++ b/news/SUP-39511.bugfix @@ -0,0 +1,2 @@ +Fix frozen_suspension state +[jchandelle] \ No newline at end of file diff --git a/src/Products/urban/migration/update_codt_2024.py b/src/Products/urban/migration/update_codt_2024.py index 36c96f10e..691579df5 100644 --- a/src/Products/urban/migration/update_codt_2024.py +++ b/src/Products/urban/migration/update_codt_2024.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +from liege.urban.migration.utils import refresh_workflow_permissions from Products.urban import URBAN_TYPES from Products.urban.setuphandlers import createFolderDefaultValues from datetime import datetime @@ -313,3 +314,16 @@ def add_new_index_and_new_filter(context): ) logger.info("upgrade done!") + + +def fix_supended_state_licence(context): + logger = logging.getLogger("urban: Fix supended state licence") + logger.info("starting upgrade steps") + portal = api.portal.get() + urban_path = "/".join(portal["urban"].getPhysicalPath()) + refresh_workflow_permissions( + "codt_buildlicence_workflow", + folder_path=urban_path, + for_states=["suspension", "frozen_suspension"] + ) + logger.info("upgrade done!") diff --git a/src/Products/urban/migration/upgrades.zcml b/src/Products/urban/migration/upgrades.zcml index b13876f13..18e2cde54 100644 --- a/src/Products/urban/migration/upgrades.zcml +++ b/src/Products/urban/migration/upgrades.zcml @@ -208,4 +208,13 @@ profile="Products.urban:default" /> + + diff --git a/src/Products/urban/profiles/default/metadata.xml b/src/Products/urban/profiles/default/metadata.xml index a3526fdf7..c0a22c909 100644 --- a/src/Products/urban/profiles/default/metadata.xml +++ b/src/Products/urban/profiles/default/metadata.xml @@ -1,6 +1,6 @@ - 1141 + 1142 profile-Products.urban:preinstall diff --git a/src/Products/urban/workflows/codt_licence_workflow.py b/src/Products/urban/workflows/codt_licence_workflow.py index a1d766a80..841fb5501 100644 --- a/src/Products/urban/workflows/codt_licence_workflow.py +++ b/src/Products/urban/workflows/codt_licence_workflow.py @@ -58,4 +58,19 @@ class StateRolesMapping(BaseRoleMapping): BaseRoleMapping.get_readers: ("Reader",), BaseRoleMapping.get_editors: ("Reader", "Reviewer"), }, + "obsolete": { + BaseRoleMapping.get_readers: ("Reader",), + BaseRoleMapping.get_editors: ("Reader", "Reviewer"), + BaseRoleMapping.get_opinion_editors: ("Reader",), + }, + "suspension": { + BaseRoleMapping.get_readers: ("Reader",), + BaseRoleMapping.get_editors: ("Reader", "Reviewer"), + BaseRoleMapping.get_opinion_editors: ("Reader",), + }, + "frozen_suspension": { + BaseRoleMapping.get_readers: ("Reader",), + BaseRoleMapping.get_editors: ("Reader", "Reviewer"), + BaseRoleMapping.get_opinion_editors: ("Reader",), + }, } From 53e211148d79c690ab11ed0b52e0719d1c62457f Mon Sep 17 00:00:00 2001 From: jimbiscuit Date: Tue, 26 Nov 2024 09:45:59 +0100 Subject: [PATCH 2/2] SUP-40874. Rename news with correct ticket number --- news/{SUP-39511.bugfix => SUP-40874.bugfix} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename news/{SUP-39511.bugfix => SUP-40874.bugfix} (100%) diff --git a/news/SUP-39511.bugfix b/news/SUP-40874.bugfix similarity index 100% rename from news/SUP-39511.bugfix rename to news/SUP-40874.bugfix