Discussion:
[jboss-user] [jBPM] - jBPM 5.4 : forwarding task PermissionDeniedException when user is actualOwner but not in potential owners
gonzalad
2013-02-19 14:13:03 UTC
Permalink
gonzalad [https://community.jboss.org/people/gonzalad] created the discussion

"jBPM 5.4 : forwarding task PermissionDeniedException when user is actualOwner but not in potential owners"

To view the discussion, visit: https://community.jboss.org/message/798352#798352

--------------------------------------------------------------
Hello,

I have the following scenario :
* user admin creates a task for group businessGroup and user admin.
* user demo (belonging to businessGroup) starts working on the task (taskService.start).
* user demo forwards the task to another group.

I get :

Caused by: org.jbpm.task.service.PermissionDeniedException: User '[User:'demo']' does not have permissions to execution operation 'Forward' on task id 35
  at org.jbpm.task.service.TaskServiceSession.evalCommand(TaskServiceSession.java:281) [classes:]
  at org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:428) [classes:]
  at org.jbpm.task.service.local.LocalTaskService.forward(LocalTaskService.java:141) [jbpm-human-task-core-5.4.0.Final.jar:5.4.0.Final]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_24]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_24]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_24]
  at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_24]
  at org.jboss.weld.bean.proxy.AbstractBeanInstance.invoke(AbstractBeanInstance.java:44) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
  at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:105) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
  at org.jboss.weld.proxies.TaskService$161873013$Proxy$_$$_WeldClientProxy.forward(TaskService$161873013$Proxy$_$$_WeldClientProxy.java) [weld-core-1.1.9.Final.jar:]
  at com.natixis.odeon.process.SampleProcessService.forward(SampleProcessService.java:103) [classes:]
 
gonzalad
2013-02-19 14:37:01 UTC
Permalink
gonzalad [https://community.jboss.org/people/gonzalad] created the discussion

"Re: jBPM 5.4 : forwarding task PermissionDeniedException when user is actualOwner but not in potential owners"

To view the discussion, visit: https://community.jboss.org/message/798355#798355

--------------------------------------------------------------
For now, I'm adding actualOwner to potentialOwner as a temporary solution just before calling forward.


// add actualOwner to potentialOwners
Task task = taskService.getTask(taskId);
org.jbpm.task.User actualOwner = task.getTaskData().getActualOwner();
if (actualOwner != null) {
  PeopleAssignments peopleAssignments = task.getPeopleAssignments();
  if (! peopleAssignments.getPotentialOwners().contains(actualOwner)) {
    peopleAssignments.getPotentialOwners().add(actualOwner);
  }
}
 
taskService.forward(taskSummary.getId(), username, targetGroupname);
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/798355#798355]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
gonzalad
2013-02-19 14:40:38 UTC
Permalink
gonzalad [https://community.jboss.org/people/gonzalad] created the discussion

"Re: jBPM 5.4 : forwarding task PermissionDeniedException when user is actualOwner but not in potential owners"

To view the discussion, visit: https://community.jboss.org/message/798356#798356

--------------------------------------------------------------
Created https://issues.jboss.org/browse/JBPM-3927 https://issues.jboss.org/browse/JBPM-3927

Thanks,
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/798356#798356]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
gonzalad
2013-02-19 19:17:42 UTC
Permalink
gonzalad [https://community.jboss.org/people/gonzalad] created the discussion

"Re: jBPM 5.4 : forwarding task PermissionDeniedException when user is actualOwner but not in potential owners"

To view the discussion, visit: https://community.jboss.org/message/798410#798410

--------------------------------------------------------------
Also, a similar case is produced I think (I musy verify it tomorrow) when user belongs to a group and task.potentialOwner contains only the group, not the user.

Perhaps, changing userIsExplicitPotentialOwner is needed to also check if user belongs to one of the groups contained in task.potentialOwner.

I'll do some more tests tomorrow for this and update my temporary solution.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/798410#798410]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
gonzalad
2013-02-20 11:07:54 UTC
Permalink
gonzalad [https://community.jboss.org/people/gonzalad] created the discussion

"Re: jBPM 5.4 : forwarding task PermissionDeniedException when user is actualOwner but not in potential owners"

To view the discussion, visit: https://community.jboss.org/message/798545#798545

--------------------------------------------------------------
Post by gonzalad
Also, a similar case is produced I think (I musy verify it tomorrow) when user belongs to a group and task.potentialOwner contains only the group, not the user.
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.
So, this scenario isn't possible per the spec ;(

I'm deviating the original subject, so I should open another thread about how to forward / reassign / delegate / whatever a task to a group.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/798545#798545]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
Loading...