cancel
Showing results for 
Search instead for 
Did you mean: 

use ldap group in activiti

skverma02
Confirmed Champ
Confirmed Champ

how can access group created in ldap in activiti?

9 REPLIES 9

gdharley
Elite Collaborator
Elite Collaborator

A little short on detail here.

What do you want to do with the group and is it the same LDAP server you are authenticating against?

skverma02
Confirmed Champ
Confirmed Champ

i want to assign some user into group and use group as candidate group in activiti workflow .
i am successfully done with ldap and activiti configuration and also created a group in ldap. but i am not able to access group in activiti through ldap?

gdharley
Elite Collaborator
Elite Collaborator

Why do you want to add the users to a group and then assign the group to the task?

Why not simply assign a list of users to the candidate users list?

I ask this because if you use a group and change the membership in one process instance, what happens if you have  second (or third, or 5 thousandth) process instance doing exactly the same thing to the same group?

What Im saying is that your design will almost certainly lead to conflict under load.

Greg

skverma02
Confirmed Champ
Confirmed Champ

actually i want to assign a task to a user which is not present in the candidate user list in the running workflow. 

Lets assume, a task is assigned to a user "A" but i want assign this task to another user "B" which is not present in flow as well as in candidate user list.

Give me the solution, how to do it. 

 

gdharley
Elite Collaborator
Elite Collaborator

Dynamic assignment is simple as long as the user exists in the User repository.

Simply create a task Listener associated with the "assign" event (not create assign happens before create).

Inside the task listener add the following code:

task.assign(<theTaskIdIWantToUse>);

To be honest, in anything other than the most trivial processes, all task assignment is dynamic.

Greg

skverma02
Confirmed Champ
Confirmed Champ

i am do a experiment make a test workflow and in userTask i am not assign or not have a candidate user .

i am start the task . and use this query to assign the task to a user exists in the user repository.

query is

 {"action":"claim","assignee":"userIdA"}

and rest url is 

http://localhost:8080/activiti-rest/service/runtime/tasks/taskId

its successfully assign  the task userIdA.
is this a correct way assign the task to a user?

the test workflow is

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
<process id="test" isExecutable="true">
<startEvent id="sid-84EF1826-E6B3-4B4A-ADEF-DFA769634AD3"></startEvent>
<userTask id="first" name="1st"></userTask>
<endEvent id="sid-FE957320-DCF3-44E0-B144-A484AB68C16E"></endEvent>
<sequenceFlow id="sid-35A5A877-5A9A-46C0-B869-F6E54B7E5004" sourceRef="sid-84EF1826-E6B3-4B4A-ADEF-DFA769634AD3" targetRef="first"></sequenceFlow>
<sequenceFlow id="sid-F40223AB-C341-4D69-92F7-A69F007A40C9" sourceRef="second" targetRef="sid-FE957320-DCF3-44E0-B144-A484AB68C16E"></sequenceFlow>
<userTask id="second" name="2nd"></userTask>
<sequenceFlow id="sid-FB2FC6D3-56CD-422E-8A0A-AAB3E44BAC95" sourceRef="first" targetRef="second"></sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_test">
<bpmndi:BPMNPlane bpmnElement="test" id="BPMNPlane_test">
<bpmndi:BPMNShape bpmnElement="sid-84EF1826-E6B3-4B4A-ADEF-DFA769634AD3" id="BPMNShape_sid-84EF1826-E6B3-4B4A-ADEF-DFA769634AD3">
<omgdc:Bounds height="30.0" width="30.0" x="93.25" y="191.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="first" id="BPMNShape_first">
<omgdc:Bounds height="80.0" width="100.0" x="226.25" y="166.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-FE957320-DCF3-44E0-B144-A484AB68C16E" id="BPMNShape_sid-FE957320-DCF3-44E0-B144-A484AB68C16E">
<omgdc:Bounds height="28.0" width="28.0" x="678.25" y="192.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="second" id="BPMNShape_second">
<omgdc:Bounds height="80.0" width="100.0" x="443.25" y="166.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-F40223AB-C341-4D69-92F7-A69F007A40C9" id="BPMNEdge_sid-F40223AB-C341-4D69-92F7-A69F007A40C9">
<omgdi:waypoint x="543.25" y="206.0"></omgdi:waypoint>
<omgdi:waypoint x="678.25" y="206.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-35A5A877-5A9A-46C0-B869-F6E54B7E5004" id="BPMNEdge_sid-35A5A877-5A9A-46C0-B869-F6E54B7E5004">
<omgdi:waypoint x="123.25" y="206.0"></omgdi:waypoint>
<omgdi:waypoint x="226.25" y="206.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-FB2FC6D3-56CD-422E-8A0A-AAB3E44BAC95" id="BPMNEdge_sid-FB2FC6D3-56CD-422E-8A0A-AAB3E44BAC95">
<omgdi:waypoint x="326.25" y="206.0"></omgdi:waypoint>
<omgdi:waypoint x="443.25" y="206.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

gdharley
Elite Collaborator
Elite Collaborator

Totally depends on your scenario.

Typically you would assign a task inside your process model or at least add candidate users there.

The claim action is meant to be used by candidate uses to take ownership of a task that is assigned to a group of users.

Greg

skverma02
Confirmed Champ
Confirmed Champ

yes its depends on my scenario.
i m successfully assign the task at run time  and its work fine.

but i have another question can we reassign a task to someone else user.

lets assume a task is assign to "user A" and we want to assign this task to "user B"  

i am using query to assign a task to "user A " is 

query is

 {"action":"claim","assignee":"userIdA"}

and rest url is 

http://localhost:8080/activiti-rest/service/runtime/tasks/taskId

what is the way of assign this task to a user B.?

skverma02
Confirmed Champ
Confirmed Champ

You must call the two REST APIs in order.

 

1. unclaim

POST runtime/tasks/%taskId%

{
"action": "claim",
"assignee": null
}

 

2. claim

POST runtime/tasks/%taskId%

{
"action": "claim",
"assignee": %userId%
}

 

Reference

15.7.5. Task actions

Activiti User Guide