Retrieve username and password of the current modifier of WI
Hi,
I am trying to retrieve and print the username and password of the user who has logged into RTC currently and is modifying the work item. Could someone please guide me on how to do this? Thanks for your help! Ananya |
3 answers
Hi Ralph,
Let me explain. By user/modifier I mean, for example the person who would open a work item and change the state from 'New' to 'In Progress'. I want to retrieve the username and password of this user, that is whoever is modifying and saving the work item during the current execution of code(BuildOnStateChangeParticipant.java). Please let me know if I am not clear. Thanks! Comments
sam detweiler
commented Dec 08 '12, 5:52 p.m.
you can get the userid, not the password.
And the user ID of the user in which context a server extension such as a Participant runs can be retrieved using this.getAuthenticatedContributor().
Ralph Schoon
commented Dec 09 '12, 4:56 p.m.
| edited Dec 09 '12, 4:56 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
And as a last thought, you could also use the feeds to listen to who changed the work items. This would also not require to extend RTC, you would use an external feed reader to get and process the events.
Ananya Joisa
commented Dec 14 '12, 8:50 a.m.
Thank you Ralph and Sam for replying. The use case is that, the build.xml I use has scripts that run in AFS. Hence I am using the AFS username and password as RTC credentials and I am trying to retrieve it from the code and then pass it to build.xml, where I can login to AFS and run my scripts. I don't want to hard code the username and password in the ant task(rexec) that I am using, hence I am trying to retrieve the UID and password from the code and pass it to build.xml.
this.getAuthenticatedContributor() returns the contributor that is performing the Participant, which is the person modifying. You can also access the work item *s attribute workItem.getModifiedBy().
|
watch out using feeds, these must be polled, and as such can have a detrimental impact on the system.
|
Thank you Ralph, for replying. I was able to get help to retrieve the userId. The following worked for me.
IContributor authenticatedContributor = (IContributor)(getService(IRepositoryItemService.class).fetchItem(getAuthenticatedContributor(), null)); authenticatedContributor.getUserId(); Thanks, Ananya |
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.
Comments
It is unclear what you want to do and why, please be more specific.