Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SUP-40874. Fix frozen_suspension state (#291) #300

Draft
wants to merge 2 commits into
base: liege-urban2.5.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions news/SUP-40874.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix frozen_suspension state
[jchandelle]
14 changes: 14 additions & 0 deletions src/Products/urban/migration/update_codt_2024.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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!")
9 changes: 9 additions & 0 deletions src/Products/urban/migration/upgrades.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,13 @@
profile="Products.urban:default"
/>

<gs:upgradeStep
title="Fix supended state licence"
description=""
source="1141"
destination="1142"
handler=".update_codt_2024.py.fix_supended_state_licence"
profile="Products.urban:default"
/>

</configure>
2 changes: 1 addition & 1 deletion src/Products/urban/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<metadata>
<version>1141</version>
<version>1142</version>
<dependencies>
<dependency>profile-Products.urban:preinstall</dependency>
</dependencies>
Expand Down
15 changes: 15 additions & 0 deletions src/Products/urban/workflows/codt_licence_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",),
},
}