diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/terraform_deployed_environment.yml b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/terraform_deployed_environment.yml index 2e41e3b00..731de9ab0 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/terraform_deployed_environment.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/terraform_deployed_environment.yml @@ -148,33 +148,18 @@ permissions: allowed_permissions: [create, read, update, delete] uri: /v1.0/process-groups/manage-procurement:procurement:* - manage-revenue-streams-instantiate: - groups: ["core-contributor", "demo"] - users: [] - allowed_permissions: [create] - uri: /v1.0/process-models/manage-revenue-streams:product-revenue-streams:customer-contracts-trade-terms/* manage-revenue-streams-instances: groups: ["core-contributor", "demo"] users: [] allowed_permissions: [create, read] uri: /v1.0/process-instances/manage-revenue-streams:product-revenue-streams:customer-contracts-trade-terms/* - manage-procurement-invoice-instantiate: - groups: ["core-contributor", "demo"] - users: [] - allowed_permissions: [create] - uri: /v1.0/process-models/manage-procurement:procurement:core-contributor-invoice-management:* manage-procurement-invoice-instances: groups: ["core-contributor", "demo"] users: [] allowed_permissions: [create, read] uri: /v1.0/process-instances/manage-procurement:procurement:core-contributor-invoice-management:* - manage-procurement-instantiate: - groups: ["core-contributor", "demo"] - users: [] - allowed_permissions: [create] - uri: /v1.0/process-models/manage-procurement:vendor-lifecycle-management:* manage-procurement-instances: groups: ["core-contributor", "demo"] users: [] diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py index 4a0100d33..3bc21456e 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py @@ -2550,7 +2550,7 @@ class TestProcessApi(BaseTest): f"/v1.0/process-models/{modified_original_process_model_id}/move?new_location={new_location}", headers=self.logged_in_headers(with_super_admin_user), ) - assert response.status_code == 201 + assert response.status_code == 200 assert response.json["id"] == new_process_model_path # make sure the original model does not exist @@ -2595,7 +2595,7 @@ class TestProcessApi(BaseTest): f"/v1.0/process-groups/{modified_original_process_group_id}/move?new_location={new_location}", headers=self.logged_in_headers(with_super_admin_user), ) - assert response.status_code == 201 + assert response.status_code == 200 assert response.json["id"] == new_sub_path # make sure the original subgroup does not exist diff --git a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx index 3584a6d27..ade2cda5c 100644 --- a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx +++ b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx @@ -58,7 +58,7 @@ import { Can } from '@casl/react'; import HttpService from '../services/HttpService'; import ButtonWithConfirmation from './ButtonWithConfirmation'; -import { makeid } from '../helpers'; +import { getBpmnProcessIdentifiers, makeid } from '../helpers'; import { useUriListForPermissions } from '../hooks/UriListForPermissions'; import { PermissionsToCheck, ProcessInstanceTask } from '../interfaces'; import { usePermissionFetcher } from '../hooks/PermissionService'; @@ -231,8 +231,10 @@ export default function ReactDiagramEditor({ function handleElementClick(event: any) { if (onElementClick) { const canvas = diagramModeler.get('canvas'); - const rootElement = canvas.getRootElement(); - onElementClick(event.element, rootElement); + const bpmnProcessIdentifiers = getBpmnProcessIdentifiers( + canvas.getRootElement() + ); + onElementClick(event.element, bpmnProcessIdentifiers); } } @@ -357,11 +359,15 @@ export default function ReactDiagramEditor({ canvas: any, processInstanceTask: ProcessInstanceTask, bpmnIoClassName: string, - bpmnRootElementId: string + bpmnProcessIdentifiers: string[] ) { if (checkTaskCanBeHighlighted(processInstanceTask.name)) { try { - if (bpmnRootElementId === processInstanceTask.process_identifier) { + if ( + bpmnProcessIdentifiers.includes( + processInstanceTask.process_identifier + ) + ) { canvas.addMarker(processInstanceTask.name, bpmnIoClassName); } } catch (bpmnIoError: any) { @@ -403,24 +409,28 @@ export default function ReactDiagramEditor({ // Option 3 at: // https://github.com/bpmn-io/bpmn-js-examples/tree/master/colors if (readyOrWaitingProcessInstanceTasks) { - const rootElement = canvas.getRootElement(); + const bpmnProcessIdentifiers = getBpmnProcessIdentifiers( + canvas.getRootElement() + ); readyOrWaitingProcessInstanceTasks.forEach((readyOrWaitingBpmnTask) => { highlightBpmnIoElement( canvas, readyOrWaitingBpmnTask, 'active-task-highlight', - rootElement.id + bpmnProcessIdentifiers ); }); } if (completedProcessInstanceTasks) { - const rootElement = canvas.getRootElement(); + const bpmnProcessIdentifiers = getBpmnProcessIdentifiers( + canvas.getRootElement() + ); completedProcessInstanceTasks.forEach((completedTask) => { highlightBpmnIoElement( canvas, completedTask, 'completed-task-highlight', - rootElement.id + bpmnProcessIdentifiers ); }); } diff --git a/spiffworkflow-frontend/src/helpers.tsx b/spiffworkflow-frontend/src/helpers.tsx index 0b73e517d..8f6255335 100644 --- a/spiffworkflow-frontend/src/helpers.tsx +++ b/spiffworkflow-frontend/src/helpers.tsx @@ -213,3 +213,24 @@ export const refreshAtInterval = ( clearTimeout(timeoutRef); }; }; + +const getChildProcesses = (bpmnElement: any) => { + let elements: string[] = []; + bpmnElement.children.forEach((c: any) => { + if (c.type === 'bpmn:Participant') { + if (c.businessObject.processRef) { + elements.push(c.businessObject.processRef.id); + } + elements = [...elements, ...getChildProcesses(c)]; + } else if (c.type === 'bpmn:SubProcess') { + elements.push(c.id); + } + }); + return elements; +}; + +export const getBpmnProcessIdentifiers = (rootBpmnElement: any) => { + const childProcesses = getChildProcesses(rootBpmnElement); + childProcesses.push(rootBpmnElement.businessObject.id); + return childProcesses; +}; diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx index 3e0c2094d..7a9b97943 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx @@ -392,13 +392,13 @@ export default function ProcessInstanceShow() { const handleClickedDiagramTask = ( shapeElement: any, - bpmnRootElement: any + bpmnProcessIdentifiers: any ) => { if (tasks) { const matchingTask: any = tasks.find( (task: any) => task.name === shapeElement.id && - task.process_identifier === bpmnRootElement.id + bpmnProcessIdentifiers.includes(task.process_identifier) ); if (matchingTask) { setTaskToDisplay(matchingTask);