JBoss Community

Re: PermissionDeniedException on task Claim

created by José Luis Granda in jBPM - View the full discussion

Sure, it is my claim method

 

public static void claimTask(TaskClient client, long taskId, String userId) throws InterruptedException {

 

        BlockingTaskOperationResponseHandler responseHandler = new BlockingTaskOperationResponseHandler();

 

        responseHandler.waitTillDone(5000);

 

        // Thread.sleep(10000);

 

        responseHandler = new BlockingTaskOperationResponseHandler();

 

       

 

        client.claim(taskId, userId, responseHandler);

 

        responseHandler.waitTillDone(5000);

 

    }

 

I have a procces with two human tasks, each one assing to Group ridrensur.financiero.secretaria (see bpmn fragment after). When I start process the first task is created with createby_id and actualowner_id to ridrensur.financiero.secretaria, it is a group in organizationalentity

 

<potentialOwner>

        <resourceAssignmentExpression>

          <formalExpression>ridrensur.financiero.secretaria</formalExpression>

        </resourceAssignmentExpression>

      </potentialOwner>

 

I have code for list Group Task

 

public static List<TaskSummary> getUnassignedTasks(TaskClient client, String idRef,

            List<String> roles, String participationType) {

        List<TaskSummary> result = new ArrayList<TaskSummary>();

        try {

            BlockingTaskSummaryResponseHandler responseHandler = new BlockingTaskSummaryResponseHandler();

            if (roles == null) {

                client.getTasksAssignedAsPotentialOwner(idRef, "en-UK",

                        responseHandler);

            } else {

                client.getTasksAssignedAsPotentialOwner(idRef, roles, "en-UK",

                        responseHandler);

            }

            result = responseHandler.getResults();

        } catch (Throwable t) {

            t.printStackTrace();

        }

        return result;

    }

It not works by ridrensur.financiero.secretaria is a Group, for run it I have to change createby_id to "Administrator" and actualowner_id to null in task, then getUnassignedTasks method works correctly. In the group list view I have claim for an user the first task from my user view button labeling as "claim", get current user from session. This button call for claimTask method.

 

I trace claim method on org.jbpm.task.service.TaskClient (https://github.com/krisv/jbpm/blob/master/jbpm-human-task/src/main/java/org/jbpm/task/service/TaskClient.java) and org.jbpm.task.service.TaskServiceSession.java

 

I get trace exception

 

10:13:43,780 ERROR [STDERR] org.jbpm.task.service.PermissionDeniedException: User '[User:'joseluis']' does not have permissions to execution operation 'Claim' on task id 258

10:13:43,780 ERROR [STDERR]     at org.jbpm.task.service.TaskServiceSession.evalCommand(TaskServiceSession.java:206)

10:13:43,780 ERROR [STDERR]     at org.jbpm.task.service.TaskServiceSession.taskOperation(TaskServiceSession.java:344)

10:13:43,780 ERROR [STDERR]     at org.jbpm.task.service.TaskServerHandler.messageReceived(TaskServerHandler.java:84)

10:13:43,780 ERROR [STDERR]     at org.jbpm.task.service.mina.MinaTaskServerHandler.messageReceived(MinaTaskServerHandler.java:41)

10:13:43,780 ERROR [STDERR]     at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:752)

 

...

 

Message receieved on client : OperationResponse

10:13:43,793 INFO  [STDOUT] [2011-04-29 10:13:43,792:debug] Arguments : [org.jbpm.task.service.PermissionDeniedException: User '[User:'joseluis']' does not have permissions to execution operation 'Claim' on task id 258]

10:13:43,793 ERROR [STDERR] org.jbpm.task.service.PermissionDeniedException: Server-side Exception: User '[User:'joseluis']' does not have permissions to execution operation 'Claim' on task id 258

10:13:43,794 ERROR [STDERR]     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

10:13:43,794 ERROR [STDERR]     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

10:13:43,794 ERROR [STDERR]     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

10:13:43,794 ERROR [STDERR]     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

10:13:43,794 ERROR [STDERR]     at org.jbpm.task.service.responsehandlers.AbstractBaseResponseHandler.createSideException(AbstractBaseResponseHandler.java:74)

10:13:43,794 ERROR [STDERR]     at org.jbpm.task.service.responsehandlers.AbstractBlockingResponseHandler.waitTillDone(AbstractBlockingResponseHandler.java:48)

10:13:43,794 ERROR [STDERR]     at org.loxageek.jbpm.server.TaskServerUtilities.claimTask(TaskServerUtilities.java:197)

10:13:43,794 ERROR [STDERR]     at org.loxageek.ppless.client.action.TaskAction.claimTask(TaskAction.java:162)

 

I trace isAllowed method in org.jbpm.task.service.TaskServiceSession.java. The question is: How I can register claim operation for user member of group or anyone? and how will define group assingment in XML? Thanks.

Reply to this message by going to Community

Start a new discussion in jBPM at Community