It's all about the answers!

Ask a question

How get current user in RTC plugin


Dmitry A. Lesin (21212953) | asked Jun 18 '14, 6:45 a.m.
edited Jun 18 '14, 6:46 a.m. by Ralph Schoon (56.3k23642)
Hello!
We built an RTC extension plug-in which is triggered when an RTC work item is updated. We need to get the info about current connected user who changed the work item (and this action triggered the plug-in). Is any way get information about the use who is currently modifying the work item?
We tried to use this construction:

IWorkItem oldState = (IWorkItem) saveParameter.getOldState();
iContributorHandle = oldState.getModifiedBy();
wi_tmp = (IWorkItem) oldState;

But it seems that "oldState.getModifiedBy();" returns a user who was modifing the work item before the current modification (another word, it was saved in result of the previous call of the plug-in)!

I will appreciate any advices and ideas!
Thank you in advance!

Accepted answer


permanent link
Ralph Schoon (56.3k23642) | answered Jun 18 '14, 6:50 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jun 18 '14, 6:52 a.m.
The old state will return the user ID that modified the work item to get to that state. The new state should give you the current user that modified the work item to this one.

Also, the operational behavior runs in the context of the user that runs the operation. See https://rsjazz.wordpress.com/2012/11/30/a-create-approval-work-item-save-participant/ and https://rsjazz.wordpress.com/2014/05/26/only-owner-can-close-workitem-advisor/ which both access the current user using
	IContributorHandle loggedIn = this.getAuthenticatedContributor();
Your extension must extend AbstractService to access this method.
Dmitry A. Lesin selected this answer as the correct answer

Comments
Dmitry A. Lesin commented Jun 18 '14, 8:05 a.m.

Thank you!
It works perfect:

IContributorHandle loggedIn = this.getAuthenticatedContributor();

Your answer


Register or to post your answer.