11 Replies Latest reply: Feb 25, 2014 5:41 AM by Andreas G. RSS

    PermissionDeniedException on task Claim

    tomashuryn Newbie

      I've tried to claim the task outside of jBPM console. Exception has been thrown:

       

      11:21:30,128 INFO  [STDOUT] [2011:03:73 11:03:128:debug] Arguments : [org.jbpm.task.service.PermissionDeniedException: User '[User:'krisv']' was unable to execution operation 'Claim' on task id 13 due to no 'current status' matchines

       

      I could not find any security relations of tasks and users/groups. Could somebody help me, please?

        • 1. PermissionDeniedException on task Claim
          Matus Majchrak Newbie

          HI, in order to claim the task, the task has to be in a Ready state, i.e. it has to have the Status.Ready status. See  http://hudson.jboss.org/hudson/job/jBPM5/lastSuccessfulBuild/artifact/target/jbpm-5.1-SNAPSHOT-docs-build/jbpm-docs/html_single/index.html#d0e179.  You probably tried to invoke the claim operation on a task, that has already been assigned to someone.Please note, that If the task only has one pottential owner(like in the self evaluation process in the jbpm5 demo) it is assigned to him automatically. Try to load the task a have a look at the status attribute. 

          • 2. PermissionDeniedException on task Claim
            José Luis Granda Newbie

            Hi Matus in effect, I did change to Status.Ready and pass [org.jbpm.task.service.PermissionDeniedException: User '[User:'krisv']' was unable to execution operation 'Claim' on task id 13 due to no 'current status' matchines, but get [org.jbpm.task.service.PermissionDeniedException: User '[User:'krisv']' does not have permissions to execution operation 'Claim' on task id.

             

            I try assign user to Potential Owner, it works, but the original task owner is a group accounting, the claim user is member of this group. Any Idea?

            • 3. PermissionDeniedException on task Claim
              bpmn2user Expert

              Do you want to post the example code you used? It might be possble to suggest a solution if you share the sample code you have used.

              • 4. PermissionDeniedException on task Claim
                José Luis Granda Newbie

                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.

                • 5. Re: PermissionDeniedException on task Claim
                  alphan arslan Newbie

                  Hi José

                  Maybe its too late but i wanna share my solution for others

                   

                  I had the same issue but i solve the problem by adding modified org/jbpm/task/service/operations-dsl.mvel file to the classpath

                  You can change the operation requirements with this file

                  Operation.Claim

                          : [ new OperationCommand().{

                                  status = [ Status.Ready,Status.Reserved ],

                                  allowed = [Allowed.Anyone, Allowed.PotentialOwner, Allowed.BusinessAdministrator ],   

                                  setNewOwnerToUser = true,          

                                  newStatus = Status.Reserved

                              } ],

                  this solved my problem

                   

                  In an other way you can extend TaskService by changing the Map<Operation, List<OperationCommand>> operations field and use this with the TaskServer implementations

                   

                  regards

                  • 6. Re: PermissionDeniedException on task Claim
                    José Luis Granda Newbie

                    thank you alphan, this information is very usefully for me.

                    • 7. Re: PermissionDeniedException on task Claim
                      sariner marry Newbie

                      hi jose ,did you hava solve this question ,I also meet this problem,could help me

                      • 8. Re: PermissionDeniedException on task Claim
                        José Luis Granda Newbie

                        Hi xiaoxian, you can try alphan suggestion this works.

                        • 9. Re: PermissionDeniedException on task Claim
                          sariner marry Newbie

                          thank you ,I have solve,because i before Claim the task ,the task hava been claimed by another user,

                           

                           

                          by the way ,I want ask your another question,did you  know how

                          [Jbpm5.2] to get the image showing the current status of  a workflow in the web application?

                          • 10. Re: PermissionDeniedException on task Claim
                            cold gin Newbie

                            I receive the same exact error when my tasks go from claimed to released status (in rapid succession, ie - click claim/release, claim/release, buttons quickly ). I tried creating a modified operations-dsl.mvel with the settings described above. I added this file to my project classpath, but it had no effect. I also tried to directly modify the operations-dsl.mvel that resides inside of jbpm-human-task-war.war, but that did not work either. Here is the error message:

                             

                            15:30:58,189 ERROR [stderr] (Thread-74) org.jbpm.task.service.PermissionDeniedException: User '[User:'...']' was unable to execution operation 'Release' on task id ... due to a no 'current status' match

                             

                            Any suggestions on what I could try next? jBPM version is 5.4.0.

                             

                            Thanks in advance.

                            • 11. Re: PermissionDeniedException on task Claim
                              Andreas G. Newbie

                              The reason for this exception is, that you can only claim tasks with the state READY. A task is READY if it is assigned to a group and nobody has claimed it yet.

                              Tasks which are already assigned to a user, have the state RESERVED and can't be claimed also.

                              You can find a detailed description in JBPM6 documentation.

                               

                              Andi