Skip to Content
0
Former Member
Oct 13, 2013 at 10:46 PM

The current user is not authorized to complete task

399 Views

Hey it's me again.
I made some efforts with my uwl, but I dont understand the following Problem. Whehn the Servlet tries to complete the task I get an error with the following description.

Cannot process an HTTP request to servlet [AbschlussController] in [example.org~bachelor1~ui~web] web application.

[EXCEPTION]

com.sap.bpm.exception.api.BPMIllegalAccessException: The current user is not authorized to complete task with id: bpm://bpm.sap.com/task-instance/4722f1bb33e211e3b501000000600d42

at com.sap.bpem.tm.impl.TaskInstanceManagerBean.complete(TaskInstanceManagerBean.java:155)

at com.sap.bpem.tm.impl.TaskInstanceManagerBean.complete(TaskInstanceManagerBean.java:112)

.

.

.

Caused by: com.sap.bpem.tm.exception.InvalidAuthorizationException: The user 'USER.PRIVATE_DATASOURCE.un:xxxxxxx' is not authorized to complete the task '4722f1bb33e211e3b501000000600d42'.

Did I forgot anything in the configuration?


Here is my Javacode of the Servlet

public class AbschlussController extends HttpServlet {          private static final long serialVersionUID = 1L;          public TaskInstanceManager manager = BPMFactory.getTaskInstanceManager();          protected void doPost(HttpServletRequest request,                              HttpServletResponse response) throws ServletException, IOException {                    // Initialisierung der Session und des TaskInstanceManagers                    HttpSession session = request.getSession();                    TaskInstanceManager manager = BPMFactory.getTaskInstanceManager();                    // Initialisierung der Logindaten                    IAuthentication auth = UMFactory.getAuthenticator();                    IUser user = auth.forceLoggedInUser(request, response);                    // Initialiserung der Metadaten der ausgewählten Task                    TaskMetaData metaData = (TaskMetaData) session.getAttribute("metaData");                    // Initialisierung der Bean TaskData zur späteren Verwendung in der JSP                    TaskData taskData = TaskData.getInstance();                    // Initialisierung des TaskInput-Objects aus dem Task                    URI taskIntanceId = metaData.getTaskId();                    TaskDetail taskDetail = manager.getTaskDetail(taskIntanceId);                    DataObject taskOutput = taskDetail.getOutputDataObject();                      //Ermittlung der Task-Art                    String name= metaData.getName();                    if(name.equals(new String("Anfrage formulieren"))){                              taskOutput.setString("Notebook", (String)request.getAttribute("Notebook"));//                              taskOutput.setFloat("Preis", (Float)request.getAttribute("Preis"));//                              taskOutput.setShort("Stueckzahl", (Short)request.getAttribute("Stueckzahl"));                              taskOutput.setString("Anmerkung", (String)request.getAttribute("Anmerkung"));                      }else if(name.equals(new String("Anfrage genehmigen"))){                              taskOutput.setString("Notebook", (String)request.getAttribute("Notebook"));                              taskOutput.setFloat("Preis", (Float)request.getAttribute("Preis"));                              taskOutput.setShort("Stueckzahl", (Short)request.getAttribute("Stueckzahl"));                              taskOutput.setString("Anmerkung", (String)request.getAttribute("Anmerkung"));                                String check=(String)request.getAttribute("Genehmigen");                              if(check.equals(new String("Ja"))){                                        taskOutput.setBoolean("genehmigt", true);                              }else taskOutput.setBoolean("genehmigt", false);                    }                        // Abschließen der Task                    manager.complete(metaData.getTaskId(), taskOutput);                      // Entfernen der Taskabhängigen Datenobjekte aus der Session                    session.removeAttribute("taskData");                    session.removeAttribute("metaData");                      response.sendRedirect("UWL.jsp");          }

Is it perhaps due to the fact that I implemented the code...

IAuthentication auth = UMFactory.getAuthenticator();                    IUser user = auth.forceLoggedInUser(request, response);

...in every Servlet I use?

Best Regards

Dominik