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

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

0 votes

Comments

It is unclear what you want to do and why, please be more specific.



3 answers

Permanent link
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!

0 votes

Comments

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().

Amd Sam is right, you can't get the password that way. If you could, this would be a huge security breach.

Another thought, what is the use case? You should try to use the tools out of the box and not create too much own code. You can do it, sometimes there is no way around it, but if you create too much extension code, it becomes very expensive. So try not to, unless there is a business reason, which means you save more money later than spending the money on development and maintenance of the code.

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.

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.

Ralph, I used this.getAuthenticatedContributor(), but this object does not have methods that would give the name of the modifier, for example ADMIN or ananya

Thanks for your help,
Ananya

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().

All return an IContributor or IContributorHandle. Search in my blog how to get the contributor object from that to get more data.

You won't however be able to get the password. I doubt RTC knows it. That is known on a lower level in LDAP or Tomcat. I am sure you can not access it. That is why the JBE uses a technical user to do all the build and only adds the requestor as contributor.


Permanent link
watch out using feeds, these must be polled, and as such can have a detrimental impact on the system.

0 votes


Permanent link
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

0 votes

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
× 369
× 18
× 9

Question asked: Dec 07 '12, 4:49 a.m.

Question was seen: 5,847 times

Last updated: Dec 21 '12, 4:54 a.m.

Confirmation Cancel Confirm