Get user project area and role access using plain Java API - RTC
We have an Rational Team Concert instance with many different project areas and a user may have access to one or more of these project areas.
Using the plain Java API I would like to find all the project areas a specific user has access to and what roles they have assigned to them in each of those project areas.
Initially I thought this might be quite simple but the only way I have found to do this is to dump every project area's users and roles and then sift through the output looking for the specified user. This was done with the help of the guide on this page.
Is there a more simple and efficient way to obtain this information?
Thanks for the help!
Using the plain Java API I would like to find all the project areas a specific user has access to and what roles they have assigned to them in each of those project areas.
Initially I thought this might be quite simple but the only way I have found to do this is to dump every project area's users and roles and then sift through the output looking for the specified user. This was done with the help of the guide on this page.
Is there a more simple and efficient way to obtain this information?
Thanks for the help!
Accepted answer
I think you would be able to do this:
Given that you have the IProcessItemService you can call
findProcessArea(IContributor user, IProjectAreaHandle projectAreaHandle, IProcessClientService.ALL_PROPERTIES, IProgressMonitor monitor)
You can get the IContributor by:
teamRepository.contributorManager().findContributorByUserId(userId) - will return IContributorHandle
Comments
Yes, you are correct.
IContributor user = teamRepository.loggedInContributor(); IProcessItemService processItemService = (IProcessItemService) teamRepository .getClientLibrary(IProcessItemService.class);List processAreasOfUser= processItemService.findProcessAreas(user, null, IProcessClientService.ALL_PROPERTIES , monitor);
does provide the project areas where the user is member.
1 vote
3 other answers
Hi Anurag,
Thank you!
A slight amendment should anyone else want to use this, in the RTC 4 API you get the IContributor with:
Thank you!
findProcessArea
seems to be exactly what I am looking for.
A slight amendment should anyone else want to use this, in the RTC 4 API you get the IContributor with:
teamRepository.contributorManager().fetchContributorByUserId(user)
Hi Ralph,
I appreciate your quick response. That particular link is the one I mentioned in my post above, the example on that page seems to suggest that you should get all project areas and then dump the contents of each.
I'm hoping to query RTC to find all project areas which a user has access too, avoiding the need to cycle through all project area users & roles to find what a particular user has.
Thanks!
I appreciate your quick response. That particular link is the one I mentioned in my post above, the example on that page seems to suggest that you should get all project areas and then dump the contents of each.
I'm hoping to query RTC to find all project areas which a user has access too, avoiding the need to cycle through all project area users & roles to find what a particular user has.
If I'm missing something obvious in that example or if you have any other examples please let me know.
Thanks!