It's all about the answers!

Ask a question

How to get login information - Server side

Yehiel Glass (25548986) | asked Nov 20 '13, 11:51 a.m.


How can I get information about the user that runs the Advisor/Participant on 'Save work item' Server side ?


Accepted answer

permanent link
Yehiel Glass (25548986) | answered Nov 21 '13, 8:02 a.m.

This is the code I searched for:

IRepositoryItemService itemService = getService(IRepositoryItemService.class);

IContributorHandle contributorHandle = this.getAuthenticatedContributor();

ContributorImpl contributor = (ContributorImpl)itemService.fetchItem(contributorHandle,null);

String loggedInUser = contributor.getUserId();

Ralph Schoon selected this answer as the correct answer

Ralph Schoon commented Nov 21 '13, 9:21 a.m.

Yehiel, code like that can be found here:

I can only encourage you to search for information like that on my blog. I am pretty sure I have covered the most common use cases.

One other answer

permanent link
sam detweiler (12.5k6195201) | answered Nov 20 '13, 1:44 p.m.
use the getAuthenticatedContributor() method on the AbstractService to get the contributor object

with Eclipse, you can view the definitions of all the objects & classes..

Your answer

Register or 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.