Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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?

0 votes


Accepted answer

Permanent link
Hi Andrew,

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.
Andrew Soloninka selected this answer as the correct answer

1 vote

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,944

Question asked: Jul 03 '13, 3:55 p.m.

Question was seen: 5,409 times

Last updated: Jul 04 '13, 5:25 a.m.

Confirmation Cancel Confirm