How do I determine which user is running an Asynchronous Task
I have an Asynchronous Task that runs perfectly on Tomcat and Jetty on my system. However, when I deploy it on Websphere Application Server.on another system, The Asynchronous Task errors:
TeamOperationCanceledException: CRJAZ6053E The 'Request Build' operation cannot be completed. Permission is required to complete the operation.
How do I determine which user is running the Asynchronous Task?
Accepted answer
Hi Andrew,
looking at AbstractAutoScheduledTask, it has the following method:
Which is called as part of the task context setup.
I ran a dummy test in a task, within the "runTask()" method:
and it printed out in my console:
Hope this helps.
Regards,
Jorge.
looking at AbstractAutoScheduledTask, it has the following method:
public final String getRunAsUserId() {
return Contributor.ADMIN;
}
Which is called as part of the task context setup.
I ran a dummy test in a task, within the "runTask()" method:
IRepositoryItemService repoService = getService(IRepositoryItemService.class);
IContributorHandle contribHandle = getAuthenticatedContributor();
IContributor contrib = (IContributor) repoService.fetchItem(contribHandle, IRepositoryItemService.COMPLETE);
System.out.println("User ID" + contrib.getUserId() + " name: " + contrib.getName());
and it printed out in my console:
User IDADMIN name: ADMIN
Hope this helps.
Regards,
Jorge.