It's all about the answers!

Ask a question

Get user project area and role access using plain Java API - RTC


Alex Lindley (13146) | asked Apr 08 '13, 11:50 a.m.
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!

Accepted answer


permanent link
Anurag Chaudhury (7112) | answered Apr 08 '13, 10:10 p.m.
 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



Alex Lindley selected this answer as the correct answer

Comments
1
Ralph Schoon commented Apr 09 '13, 5:10 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.

3 other answers



permanent link
Alex Lindley (13146) | answered Apr 08 '13, 3:42 p.m.
 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.

If I'm missing something obvious in that example or if you have any other examples please let me know.

Thanks!

permanent link
Ralph Schoon (63.1k33646) | answered Apr 08 '13, 11:57 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Alex,

you want to start with this post: http://rsjazz.wordpress.com/2012/12/09/analyzing-a-aroject-areas-members-and-roles-using-the-plain-java-client-libraries/ there are several more that might be of interest.


permanent link
Alex Lindley (13146) | answered Apr 09 '13, 5:12 a.m.
Hi Anurag,

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)



Comments
1
Ralph Schoon commented Apr 09 '13, 5:53 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Hi Alex, Anurag, thanks for the inspiration, I updated the blog post with the snippet.


Your answer


Register or 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.