It's all about the answers!

Ask a question

How to get logged in user without repository login in plugin?


Asha Faldu (111) | asked Mar 15 '17, 2:14 a.m.
edited Mar 15 '17, 2:58 a.m. by Ralph Schoon (57.5k23642)

 Hello Team,


we have implemented a functionality of adding logged in user in contributor list by login into repository through plugin.

currently we have implemented in this way.
   IContributor contributor = null;
ITeamRepository repo = TeamPlatform.getTeamRepositoryService().getTeamRepository(iac.getRepositoryURI());
repo.registerLoginHandler(new LoginHandler(IMSConstant.IMS_GENERIC_USER_ID, IMSConstant.IMS_GENERIC_PASSWD));
repo.login(monitor);
IContributorHandle[] iContributorHandles = operation.getProcessArea().getMembers(); 
String authenticatedUserItemId = getAuthenticatedContributor().getItemId().toString();

</pre>

Please suggest any other way to get logged in user in plugin without repository login.

One answer



permanent link
Ralph Schoon (57.5k23642) | answered Mar 15 '17, 3:01 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 You have to be logged into the repository to appear as logged in user.


Comments
Asha Faldu commented Mar 15 '17, 3:28 a.m.

 Hello Ralph,


Thanks for your reply.
Consider a scenario, user XYZ is logged in and tries to update the workitem, we want the details of the user XYZ in plugin code.

please suggest alternative solution for retrieving the details of user XYZ without pro-grammatically login into repository.


Ralph Schoon commented Mar 15 '17, 4:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 If the user is already logged int the API works as desired. For example see https://rsjazz.wordpress.com/2014/05/26/only-owner-can-close-workitem-advisor/ .


If you want more useful information, please provide more useful information in your question. Start reading this: How should I ask a question in the Forum if I want to receive useful answers?

Your answer


Register or to post your answer.