It's all about the answers!

Ask a question

How to get exactly roles for a RTC user within the exactly team area


Richar Cai (171510) | asked Feb 06 '17, 3:24 a.m.

 Dear Team,


I am writing to seek your help for RTC api question.
I tried to use RTC server java api to get the roles for a user within a team area, but the result wasn't expected.

We have the project area and team area structure as below:

Sample_Project_Area
              |Product_A_Control_Team
                                    |Sub_Dev_Team

For example:
User AA in "Product_A_Control_Team" has "developer role", and in "Sub_Dev_Team" has "guest role".
The expected result is if I fetch User AA's role within Sub_Dev_Team, it should return only "guest role" but not "developer role" and "guest role".
It seems the server api has some problem. When we try to fetch the exactly role for the sub_teamarea, the api will get all the roles the RTC User has in both sub_teamarea and it's parents teamareas.

The Server API we used is as below:
I am sure parameter of processArea we passed into is the sub teamarea ("Sub_Dev_Team").
============================
private List<String> getUserRoleList(IContributorHandle userHandle, IProcessArea processArea) throws TeamRepositoryException {
  IServerProcess serverProcess = getService(IProcessServerService.class).getServerProcess(processArea);
  //角色列表
  List<String> userRoles = new ArrayList<String>(); 
  IRole[] icbtorRoles = serverProcess.getContributorRoles(userHandle,processArea);
  
  if(icbtorRoles==null){
   return userRoles;
  }
  for (IRole irole : icbtorRoles) {
   IRole2 role = (IRole2)irole;
   userRoles.add(role.getId());
  }
  return userRoles;
 }

Anybody has any idea?
Thank you very much!

Accepted answer


permanent link
Ralph Schoon (51.8k13541) | answered Feb 06 '17, 4:39 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 As discussed try to search (Java) for method role.

You can try com.ibm.team.process.common.IProcessArea.getRoleAssignmentIds(IContributorHandle) 

Richar Cai selected this answer as the correct answer

Comments
Richar Cai commented Feb 06 '17, 5:09 a.m.

 Dear Ralph,


Thank you so much for your kind advice and help.
The API, It works for us.

Thanks&Best regards,
Richar Cai

Your answer


Register or to post your answer.