Bug 1250315 - TaskService.forward() can forward a task to a group without throwing Exception
TaskService.forward() can forward a task to a group without throwing Exception
Status: VERIFIED
Product: JBoss BPMS Platform 6
Classification: JBoss
Component: jBPM Core (Show other bugs)
6.1.0
Unspecified Unspecified
high Severity high
: ER4
: 6.2.0
Assigned To: Maciej Swiderski
Ivo Bek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-05 02:38 EDT by Hisao Furuichi
Modified: 2015-11-11 08:39 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
reproducer (6.25 KB, application/zip)
2015-08-05 02:38 EDT, Hisao Furuichi
no flags Details

  None (edit)
Description Hisao Furuichi 2015-08-05 02:38:08 EDT
Created attachment 1059325 [details]
reproducer

Description of problem:
TaskService.forward() can forward a task to a group without throwing Exception

Version-Release number of selected component (if applicable):
I tested it with BPMS 6.1.2 too.

Steps to Reproduce:
1. Download the attached JBDS project and import it to JBDS 8.1
2. Run the JUnit test

Actual results:
After forwarded to a group, "PM", taskService.getTasksAssignedAsPotentialOwner("PM", "en-UK") will return the forwarded task.

Expected results:
TaskService.forward() throws Exception when user tries to forward it to a group.

Additional info:

BPM2 specification is not clearly explain about how "forward" should behave. 
If TaskService.forward() allows user to forward a task to group, please test my reproducer with "HR".  It does not forward task to "HR".

===
4.7.3 Delegating or Forwarding a Human Task
Task’s potential owners, actual owner or business administrator can delegate a task to another user, making that user the actual owner of the task, and also adding her to the list of potential owners in case she is not, yet. A task can be delegated when it is in an active state (Ready, Reserved, InProgress), and transitions the task into the Reserved state. Business data associated with the task is kept.
Similarily, task’s potential owners, actual owner or business administrator can forward an active task to another person or a set of people, replacing himself by those people in the list of potential owners. Potential owners can only forward tasks that are in the Ready state. Forwarding is possible if the task has a set of individually assigned potential owners, not if its potential owners are assigned using one or many groups. If the task is in the Reserved or InProgress state then the task is implicitly released first, that is, the task is transitioned into the Ready state. Business data associated with the task is kept. The user performing the forward is removed from the set of potential owners of the task, and the forwardee is added to the set of potential owners.
===
Comment 1 Maciej Swiderski 2015-08-10 12:08:11 EDT
Hisao, is this still valid request based on what was clarified on mailing list?
Comment 2 Hisao Furuichi 2015-08-10 20:40:42 EDT
Hello, Maciej.

Yes. The topic on the mailing list is a bit different. This request is still valid.  If you think it's not, could you share you thought please?

Thx
Comment 3 Hisao Furuichi 2015-08-11 05:23:32 EDT
Hello. Let me explain again about what I found with the attached reproducer.

 - "john" can forward() a UserTask to "PM" group
 - "john" can not forward() a UserTask to "HR" group"
  -> please fix a code as follows:
  ===
  taskService.forward(task.getId(), "john", "HR");
  list = taskService.getTasksAssignedAsPotentialOwner("HR", "en-UK");
  System.out.println("getTasksAssinedAsPotentialOwner(HR):" + list.size());
  assertEquals(1, list.size());
  ===

If TaskService.forward() allows user to forward a task to groupId, "john" needs to be able to forward a UserTask to "HR" group.
If TaskService.forward() does not allow user to forward a task to groupId, "john" does not be able to forward a UserTask to "PM" group.

Does this make sense to you? If you need more information, please let me know.
Thank you for your help.

Regards,
Hisao
Comment 4 Maciej Swiderski 2015-08-20 10:16:46 EDT
Hisao,

enhanced support for forward to disallow forward to groups because of following reasons:
- according to WS-HT it is not allowed to forward to groups only list of individuals given as potential owners
- as you noted, it was possible to initially forward to group as it was assigned to the user that did forward and thus it worked but subsequent did not work as the user was removed from potential owners
- once the task is on a group it is not possible to remove that group while it is forwarded to the other as it does not match the individual who perform forward and then it will result in having both groups being able to claim tasks which is certainly unexpected

due to following reasons it's more consistent to stick to individuals as target entity for forward operation

jbpm
master:
https://github.com/droolsjbpm/jbpm/commit/9ba0fde3d983b5a8a81e7b3d35f6f4b2ff79273e

6.3.x:
https://github.com/droolsjbpm/jbpm/commit/959c70926d6f9c042b376fb0973aea597db11b37
Comment 5 Ivo Bek 2015-11-11 08:39:11 EST
Verified in BPM Suite 6.2.0.ER5 

User '[UserImpl:'john']' was unable to execute operation 'Forward' on task id 1 due to 'target entity cannot be group'

Note You need to log in before you can comment on or make changes to this bug.