flowable / flowable/flowable-engine

The DefaultIdentityLinkIterceptor.java creates duplicate identityLinks on ProcessInstance

Open
#3,900 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
7h 8m
Merged PRs (30d)
2

Description

**Describe the bug**
The DefaultIdentityLinkIterceptor.handleCompleteTask method creates a new PARTICIPANT IdentityLink on the ProcessInstance the tasks belongs to every time a task completes.

**Expected behavior**
There should be a check if such an IdentityLink already exists before creating it. This is done in some of the other methods in the class by calling the addUserIdentityLinkToParent which does such a check.

Noticed that we had a lot of duplicates in the IdentityLink-tables for processes with a lot of tasks.

**Code**
```
public void handleCompleteTask(TaskEntity task) {
if (Authentication.getAuthenticatedUserId() != null && task.getProcessInstanceId() != null) {
ExecutionEntity processInstanceEntity = CommandContextUtil.getExecutionEntityManager().findById(task.getProcessInstanceId());
IdentityLinkUtil.createProcessInstanceIdentityLink(processInstanceEntity,
Authentication.getAuthenticatedUserId(), null, IdentityLinkType.PARTICIPANT);
}
}
```

**Additional context**
This is present on the main branch.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.