The following workflow extends the default workflow delivered with Syncope by enabling modification of suspended users.
Yellow processes represent (Java) service tasks, whereas green and blue highlighted processes are waiting for a user interaction.
Workflow BPMN 2.0 Definition
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <definitions id="definitions" targetNamespace="http://activiti.org/bpmn20" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd"> <process id="userWorkflow" name="User Workflow"> <startEvent id="theStart"/> <!-- Create an user --> <sequenceFlow id="flow1" sourceRef="theStart" targetRef="createUser"/> <serviceTask id="createUser" name="Create user" activiti:class="org.apache.syncope.core.workflow.activiti.Create"/> <sequenceFlow id="flow2" sourceRef="createUser" targetRef="approvalRequiredGW"/> <exclusiveGateway id="approvalRequiredGW"/> <sequenceFlow id="create2Activate" sourceRef="approvalRequiredGW" targetRef="tokenRequiredGW"> <conditionExpression xsi:type="tFormalExpression">${!syncopeUser.getRoleIds().contains(9)}</conditionExpression> </sequenceFlow> <sequenceFlow id="create2userApproval" sourceRef="approvalRequiredGW" targetRef="createApproval"> <conditionExpression xsi:type="tFormalExpression">${syncopeUser.getRoleIds().contains(9)}</conditionExpression> </sequenceFlow> <userTask id="createApproval" activiti:formKey="userApproval" name="User approval" activiti:candidateGroups="7"> <extensionElements> <activiti:formProperty id="username" name="Username" type="string" writable="false" expression="${syncopeUser.username}"/> <activiti:formProperty id="approve" variable="approve" name="Approve?" type="boolean" required="true"/> <activiti:formProperty id="rejectUserReason" variable="rejectUserReason" name="Reason for rejectUsering" type="string"/> </extensionElements> </userTask> <sequenceFlow id="flow3" sourceRef="createApproval" targetRef="userapprovalRequiredGW"/> <exclusiveGateway id="userapprovalRequiredGW"/> <sequenceFlow id="userapprovalRequiredGW2tokenRequiredGW" sourceRef="userapprovalRequiredGW" targetRef="tokenRequiredGW"> <conditionExpression xsi:type="tFormalExpression">${approve}</conditionExpression> </sequenceFlow> <sequenceFlow id="userApproval2rejectUser" sourceRef="userapprovalRequiredGW" targetRef="rejectUser"> <conditionExpression xsi:type="tFormalExpression">${!approve}</conditionExpression> </sequenceFlow> <exclusiveGateway id="tokenRequiredGW"/> <!-- opt-in required --> <sequenceFlow id="userTokenRequired" sourceRef="tokenRequiredGW" targetRef="generateUserConfirmationToken"> <conditionExpression xsi:type="tFormalExpression">${syncopeUser.getRoleIds().contains(11)}</conditionExpression> </sequenceFlow> <sequenceFlow id="userTokenNotRequired" sourceRef="tokenRequiredGW" targetRef="activateUser"> <conditionExpression xsi:type="tFormalExpression">${!syncopeUser.getRoleIds().contains(11)}</conditionExpression> </sequenceFlow> <serviceTask id="activateUser" name="activateUser" activiti:class="org.apache.syncope.core.workflow.activiti.AutoActivate"/> <sequenceFlow id="flow4" sourceRef="activateUser" targetRef="userActiveGW"/> <exclusiveGateway id="userActiveGW"/> <sequenceFlow id="userapprovalRequiredGW2Active" sourceRef="userActiveGW" targetRef="active"> <conditionExpression xsi:type="tFormalExpression">${!syncopeUser.getSuspended()}</conditionExpression> </sequenceFlow> <sequenceFlow id="userapprovalRequiredGW2Suspended" sourceRef="userActiveGW" targetRef="suspendUser"> <conditionExpression xsi:type="tFormalExpression">${syncopeUser.getSuspended()}</conditionExpression> </sequenceFlow> <!-- Double opt-in required --> <serviceTask id="generateUserConfirmationToken" name="Generate token" activiti:class="org.apache.syncope.core.workflow.activiti.GenerateToken"/> <sequenceFlow id="flow5" sourceRef="generateUserConfirmationToken" targetRef="created"/> <userTask id="created" name="provideUserConfirmationToken"/> <sequenceFlow id="flow6" sourceRef="created" targetRef="tokenValidationGW"/> <exclusiveGateway id="tokenValidationGW"/> <sequenceFlow id="provideUserConfirmationToken2removeUserConfirmationToken" sourceRef="tokenValidationGW" targetRef="removeUserConfirmationToken"> <conditionExpression xsi:type="tFormalExpression">${syncopeUser.checkToken(token)}</conditionExpression> </sequenceFlow> <sequenceFlow id="provideUserConfirmationToken2provideUserConfirmationToken" sourceRef="tokenValidationGW" targetRef="created"> <conditionExpression xsi:type="tFormalExpression">${!syncopeUser.checkToken(token)}</conditionExpression> </sequenceFlow> <scriptTask id="removeUserConfirmationToken" name="Remove Token and activateUser" scriptFormat="groovy"> <script> syncopeUser.removeToken() </script> </scriptTask> <sequenceFlow id="flow7" sourceRef="removeUserConfirmationToken" targetRef="active"/> <userTask id="active" name="userActive"/> <sequenceFlow id="flow8" sourceRef="active" targetRef="suspendUserGw"/> <exclusiveGateway id="suspendUserGw"/> <sequenceFlow id="userActive2modifyUserGW" sourceRef="suspendUserGw" targetRef="modifyUserGW"> <conditionExpression xsi:type="tFormalExpression">${task != 'suspend'}</conditionExpression> </sequenceFlow> <sequenceFlow id="userActive2suspendUser" sourceRef="suspendUserGw" targetRef="suspendUser"> <conditionExpression xsi:type="tFormalExpression">${task == 'suspend'}</conditionExpression> </sequenceFlow> <exclusiveGateway id="modifyUserGW"/> <sequenceFlow id="active2updateUser" sourceRef="modifyUserGW" targetRef="updateUser"> <conditionExpression xsi:type="tFormalExpression">${task == 'update'}</conditionExpression> </sequenceFlow> <sequenceFlow id="active2deleteUser" sourceRef="modifyUserGW" targetRef="deleteUser"> <conditionExpression xsi:type="tFormalExpression">${task == 'delete'}</conditionExpression> </sequenceFlow> <!-- Update an active user --> <serviceTask id="updateUser" name="updateUser" activiti:class="org.apache.syncope.core.workflow.activiti.Update"/> <sequenceFlow id="flow9" sourceRef="updateUser" targetRef="userActiveGW"/> <!-- suspendUser an active user --> <serviceTask id="suspendUser" name="suspendUser" activiti:class="org.apache.syncope.core.workflow.activiti.Suspend"/> <sequenceFlow id="flow10" sourceRef="suspendUser" targetRef="suspended"/> <userTask id="suspended" name="UserSuspended"/> <sequenceFlow id="flow11" sourceRef="suspended" targetRef="reactivateUserGW"/> <exclusiveGateway id="reactivateUserGW"/> <sequenceFlow id="suspended2reactivate" sourceRef="reactivateUserGW" targetRef="reactivateUser"> <conditionExpression xsi:type="tFormalExpression">${task == 'reactivate'}</conditionExpression> </sequenceFlow> <sequenceFlow id="suspended2modify" sourceRef="reactivateUserGW" targetRef="modifyUserGW"> <conditionExpression xsi:type="tFormalExpression">${task != 'reactivate'}</conditionExpression> </sequenceFlow> <!-- Reactivate a suspended user --> <serviceTask id="reactivateUser" name ="reactivateUser" activiti:class="org.apache.syncope.core.workflow.activiti.Reactivate"/> <sequenceFlow id="flow12" sourceRef="reactivateUser" targetRef="active"/> <!-- rejectUser an user --> <scriptTask id="rejectUser" name="rejectUser" scriptFormat="groovy"> <!-- Do something with rejectUserReason --> <script> def scriptVar = rejectUserReason </script> </scriptTask> <sequenceFlow id="flow13" sourceRef="rejectUser" targetRef="rejectedUser"/> <userTask id="rejectedUser" name="rejectedUser"/> <sequenceFlow id="flow14" sourceRef="rejectedUser" targetRef="deleteUser"/> <!-- Delete an user (provideUserConfirmationToken, active or suspended) --> <serviceTask id="deleteUser" name="deleteUser" activiti:class="org.apache.syncope.core.workflow.activiti.Delete"/> <sequenceFlow id="flow99" sourceRef="deleteUser" targetRef="theEnd"/> <endEvent id="theEnd"/> </process> </definitions>