Skip to content

Commit 0c43d63

Browse files
authored
Merge branch changes (#29)
1 parent ca392b0 commit 0c43d63

File tree

12 files changed

+411
-32
lines changed

12 files changed

+411
-32
lines changed

backend/src/workflow/manager/api/services/workflow/transition.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
from Products.DCWorkflow.Transitions import TRIGGER_AUTOMATIC, TRIGGER_USER_ACTION
3+
from Products.DCWorkflow.Expression import Expression
34
from plone.protect.interfaces import IDisableCSRFProtection
45
from plone.restapi.deserializer import json_body
56
from plone.restapi.services import Service
@@ -279,13 +280,21 @@ def reply(self):
279280
guard = transition.getGuard()
280281
guard_data = body['guard']
281282
if 'permissions' in guard_data:
282-
guard.permissions = tuple(guard_data['permissions'])
283+
guard.permissions = tuple(
284+
Expression('string:%s' % p) for p in guard_data['permissions']
285+
)
283286
if 'roles' in guard_data:
284-
guard.roles = tuple(guard_data['roles'])
287+
guard.roles = tuple(
288+
Expression('string:%s' % r) for r in guard_data['roles']
289+
)
285290
if 'groups' in guard_data:
286-
guard.groups = tuple(guard_data['groups'])
287-
if 'expr' in guard_data:
288-
guard.expr = guard_data['expr']
291+
guard.groups = tuple(
292+
Expression('string:%s' % g) for g in guard_data['groups']
293+
)
294+
if 'expr' in guard_data and guard_data['expr']:
295+
guard.expr = Expression(guard_data['expr'])
296+
else:
297+
guard.expr = Expression('')
289298
transition.guard = guard
290299

291300
if 'states_with_this_transition' in body:

backend/src/workflow/manager/api/services/workflow/workflow.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ def reply(self):
150150
self.request.response.setStatus(404)
151151
return {"error": f"Workflow '{workflow_id}' not found."}
152152

153-
assigned_types = base.get_assigned_types_for(workflow_id)
153+
# Safety Check: Prevent deletion if workflow is in use.
154+
assigned_types = base._get_assigned_types_for(workflow_id)
154155
if assigned_types:
155156
self.request.response.setStatus(400)
156157
return {"error": f"Cannot delete workflow. It is still assigned to: {', '.join(assigned_types)}"}

frontend/packages/volto-workflow-manager/locales/de/LC_MESSAGES/volto.po

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,36 @@ msgstr ""
1111
"Content-Transfer-Encoding: \n"
1212
"Plural-Forms: \n"
1313

14+
#. Default: "Assign"
15+
#: components/Workflow/AssignWorkflow
16+
msgid "Assign"
17+
msgstr ""
18+
19+
#. Default: "Assign Workflow"
20+
#: components/Workflow/AssignWorkflow
21+
msgid "Assign Workflow"
22+
msgstr ""
23+
24+
#. Default: "Assigning..."
25+
#: components/Workflow/AssignWorkflow
26+
msgid "Assigning..."
27+
msgstr ""
28+
29+
#. Default: "Assignment Failed"
30+
#: components/Workflow/AssignWorkflow
31+
msgid "Assignment Failed"
32+
msgstr ""
33+
1434
#. Default: "Block"
1535
#: components/Workflow/WorkflowSidebar
1636
msgid "Block"
1737
msgstr ""
1838

39+
#. Default: "Cancel"
40+
#: components/Workflow/AssignWorkflow
41+
msgid "Cancel"
42+
msgstr ""
43+
1944
#. Default: "Document"
2045
#: components/Workflow/WorkflowSidebar
2146
msgid "Document"
@@ -31,6 +56,16 @@ msgstr ""
3156
msgid "Expand sidebar"
3257
msgstr ""
3358

59+
#. Default: "Failed to delete workflow."
60+
#: components/Controlpanel/WorkflowTable
61+
msgid "Failed to delete workflow."
62+
msgstr ""
63+
64+
#. Default: "Failed to rename workflow."
65+
#: components/Controlpanel/WorkflowTable
66+
msgid "Failed to rename workflow."
67+
msgstr ""
68+
3469
#. Default: "No errors found in the workflow."
3570
#: components/Workflow/ActionsToolbar
3671
msgid "No errors found in the workflow."
@@ -41,6 +76,16 @@ msgstr ""
4176
msgid "Order"
4277
msgstr ""
4378

79+
#. Default: "Select a content type..."
80+
#: components/Workflow/AssignWorkflow
81+
msgid "Select a content type..."
82+
msgstr ""
83+
84+
#. Default: "Select the content type you would like to assign this workflow to."
85+
#: components/Workflow/AssignWorkflow
86+
msgid "Select the content type you would like to assign this workflow to."
87+
msgstr ""
88+
4489
#. Default: "Settings"
4590
#: components/Workflow/WorkflowSidebar
4691
msgid "Settings"
@@ -76,6 +121,11 @@ msgstr ""
76121
msgid "The new transition has been added successfully."
77122
msgstr ""
78123

124+
#. Default: "The workflow has been assigned successfully."
125+
#: components/Workflow/AssignWorkflow
126+
msgid "The workflow has been assigned successfully."
127+
msgstr ""
128+
79129
#. Default: "Transition Created"
80130
#: components/Transitions/CreateTransition
81131
msgid "Transition Created"
@@ -105,3 +155,23 @@ msgstr ""
105155
#: components/Workflow/WorkflowSidebar
106156
msgid "Workflow"
107157
msgstr ""
158+
159+
#. Default: "Workflow Assigned"
160+
#: components/Workflow/AssignWorkflow
161+
msgid "Workflow Assigned"
162+
msgstr ""
163+
164+
#. Default: "Workflow Manager"
165+
#: components/Controlpanel/WorkflowPanel
166+
msgid "Workflow Manager"
167+
msgstr ""
168+
169+
#. Default: "Workflow deleted successfully."
170+
#: components/Controlpanel/WorkflowTable
171+
msgid "Workflow deleted successfully."
172+
msgstr ""
173+
174+
#. Default: "Workflow renamed successfully."
175+
#: components/Controlpanel/WorkflowTable
176+
msgid "Workflow renamed successfully."
177+
msgstr ""

frontend/packages/volto-workflow-manager/locales/en/LC_MESSAGES/volto.po

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,36 @@ msgstr ""
1111
"Content-Transfer-Encoding: \n"
1212
"Plural-Forms: \n"
1313

14+
#. Default: "Assign"
15+
#: components/Workflow/AssignWorkflow
16+
msgid "Assign"
17+
msgstr ""
18+
19+
#. Default: "Assign Workflow"
20+
#: components/Workflow/AssignWorkflow
21+
msgid "Assign Workflow"
22+
msgstr ""
23+
24+
#. Default: "Assigning..."
25+
#: components/Workflow/AssignWorkflow
26+
msgid "Assigning..."
27+
msgstr ""
28+
29+
#. Default: "Assignment Failed"
30+
#: components/Workflow/AssignWorkflow
31+
msgid "Assignment Failed"
32+
msgstr ""
33+
1434
#. Default: "Block"
1535
#: components/Workflow/WorkflowSidebar
1636
msgid "Block"
1737
msgstr ""
1838

39+
#. Default: "Cancel"
40+
#: components/Workflow/AssignWorkflow
41+
msgid "Cancel"
42+
msgstr ""
43+
1944
#. Default: "Document"
2045
#: components/Workflow/WorkflowSidebar
2146
msgid "Document"
@@ -31,6 +56,16 @@ msgstr ""
3156
msgid "Expand sidebar"
3257
msgstr ""
3358

59+
#. Default: "Failed to delete workflow."
60+
#: components/Controlpanel/WorkflowTable
61+
msgid "Failed to delete workflow."
62+
msgstr ""
63+
64+
#. Default: "Failed to rename workflow."
65+
#: components/Controlpanel/WorkflowTable
66+
msgid "Failed to rename workflow."
67+
msgstr ""
68+
3469
#. Default: "No errors found in the workflow."
3570
#: components/Workflow/ActionsToolbar
3671
msgid "No errors found in the workflow."
@@ -41,6 +76,16 @@ msgstr ""
4176
msgid "Order"
4277
msgstr ""
4378

79+
#. Default: "Select a content type..."
80+
#: components/Workflow/AssignWorkflow
81+
msgid "Select a content type..."
82+
msgstr ""
83+
84+
#. Default: "Select the content type you would like to assign this workflow to."
85+
#: components/Workflow/AssignWorkflow
86+
msgid "Select the content type you would like to assign this workflow to."
87+
msgstr ""
88+
4489
#. Default: "Settings"
4590
#: components/Workflow/WorkflowSidebar
4691
msgid "Settings"
@@ -76,6 +121,11 @@ msgstr ""
76121
msgid "The new transition has been added successfully."
77122
msgstr ""
78123

124+
#. Default: "The workflow has been assigned successfully."
125+
#: components/Workflow/AssignWorkflow
126+
msgid "The workflow has been assigned successfully."
127+
msgstr ""
128+
79129
#. Default: "Transition Created"
80130
#: components/Transitions/CreateTransition
81131
msgid "Transition Created"
@@ -105,3 +155,23 @@ msgstr ""
105155
#: components/Workflow/WorkflowSidebar
106156
msgid "Workflow"
107157
msgstr ""
158+
159+
#. Default: "Workflow Assigned"
160+
#: components/Workflow/AssignWorkflow
161+
msgid "Workflow Assigned"
162+
msgstr ""
163+
164+
#. Default: "Workflow Manager"
165+
#: components/Controlpanel/WorkflowPanel
166+
msgid "Workflow Manager"
167+
msgstr ""
168+
169+
#. Default: "Workflow deleted successfully."
170+
#: components/Controlpanel/WorkflowTable
171+
msgid "Workflow deleted successfully."
172+
msgstr ""
173+
174+
#. Default: "Workflow renamed successfully."
175+
#: components/Controlpanel/WorkflowTable
176+
msgid "Workflow renamed successfully."
177+
msgstr ""

frontend/packages/volto-workflow-manager/locales/es/LC_MESSAGES/volto.po

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,36 @@ msgstr ""
1818
"X-Is-Fallback-For: es-ar es-bo es-cl es-co es-cr es-do es-ec es-es es-sv es-gt es-hn es-mx es-ni es-pa es-py es-pe es-pr es-us es-uy es-ve\n"
1919
"X-Generator: Poedit 2.2.1\n"
2020

21+
#. Default: "Assign"
22+
#: components/Workflow/AssignWorkflow
23+
msgid "Assign"
24+
msgstr ""
25+
26+
#. Default: "Assign Workflow"
27+
#: components/Workflow/AssignWorkflow
28+
msgid "Assign Workflow"
29+
msgstr ""
30+
31+
#. Default: "Assigning..."
32+
#: components/Workflow/AssignWorkflow
33+
msgid "Assigning..."
34+
msgstr ""
35+
36+
#. Default: "Assignment Failed"
37+
#: components/Workflow/AssignWorkflow
38+
msgid "Assignment Failed"
39+
msgstr ""
40+
2141
#. Default: "Block"
2242
#: components/Workflow/WorkflowSidebar
2343
msgid "Block"
2444
msgstr ""
2545

46+
#. Default: "Cancel"
47+
#: components/Workflow/AssignWorkflow
48+
msgid "Cancel"
49+
msgstr ""
50+
2651
#. Default: "Document"
2752
#: components/Workflow/WorkflowSidebar
2853
msgid "Document"
@@ -38,6 +63,16 @@ msgstr ""
3863
msgid "Expand sidebar"
3964
msgstr ""
4065

66+
#. Default: "Failed to delete workflow."
67+
#: components/Controlpanel/WorkflowTable
68+
msgid "Failed to delete workflow."
69+
msgstr ""
70+
71+
#. Default: "Failed to rename workflow."
72+
#: components/Controlpanel/WorkflowTable
73+
msgid "Failed to rename workflow."
74+
msgstr ""
75+
4176
#. Default: "No errors found in the workflow."
4277
#: components/Workflow/ActionsToolbar
4378
msgid "No errors found in the workflow."
@@ -48,6 +83,16 @@ msgstr ""
4883
msgid "Order"
4984
msgstr ""
5085

86+
#. Default: "Select a content type..."
87+
#: components/Workflow/AssignWorkflow
88+
msgid "Select a content type..."
89+
msgstr ""
90+
91+
#. Default: "Select the content type you would like to assign this workflow to."
92+
#: components/Workflow/AssignWorkflow
93+
msgid "Select the content type you would like to assign this workflow to."
94+
msgstr ""
95+
5196
#. Default: "Settings"
5297
#: components/Workflow/WorkflowSidebar
5398
msgid "Settings"
@@ -83,6 +128,11 @@ msgstr ""
83128
msgid "The new transition has been added successfully."
84129
msgstr ""
85130

131+
#. Default: "The workflow has been assigned successfully."
132+
#: components/Workflow/AssignWorkflow
133+
msgid "The workflow has been assigned successfully."
134+
msgstr ""
135+
86136
#. Default: "Transition Created"
87137
#: components/Transitions/CreateTransition
88138
msgid "Transition Created"
@@ -112,3 +162,23 @@ msgstr ""
112162
#: components/Workflow/WorkflowSidebar
113163
msgid "Workflow"
114164
msgstr ""
165+
166+
#. Default: "Workflow Assigned"
167+
#: components/Workflow/AssignWorkflow
168+
msgid "Workflow Assigned"
169+
msgstr ""
170+
171+
#. Default: "Workflow Manager"
172+
#: components/Controlpanel/WorkflowPanel
173+
msgid "Workflow Manager"
174+
msgstr ""
175+
176+
#. Default: "Workflow deleted successfully."
177+
#: components/Controlpanel/WorkflowTable
178+
msgid "Workflow deleted successfully."
179+
msgstr ""
180+
181+
#. Default: "Workflow renamed successfully."
182+
#: components/Controlpanel/WorkflowTable
183+
msgid "Workflow renamed successfully."
184+
msgstr ""

0 commit comments

Comments
 (0)