Not all roles are being returned for a member in a sub team
I noticed sometimes we are not getting all the roles assigned to a user in a team area. It seems to happen when the user is a member of a team area that is a child of another team area. A user may be assigned all the roles, but only 2 of of the roles are returned. This doesn't happen in all cases so I'm not sure exactly what triggers it.
I've noticed this on Rational Team Concert version 2.
Here's a code snippet to get the user's roles:
Any help would be greatly appreciated.
I've noticed this on Rational Team Concert version 2.
Here's a code snippet to get the user's roles:
IProcessItemService service= (IProcessItemService) repo.getClientLibrary(IProcessItemService.class);
IProcessAreaWorkingCopy areaWC = (IProcessAreaWorkingCopy) service.getWorkingCopyManager().createPrivateWorkingCopy(processArea);
ITeamWorkingCopy teamWC = areaWC.getTeam();
IRole[] roles = teamWC.getRoleCast(contributor);
Any help would be greatly appreciated.
6 answers
I still see issues getting the right roles for a user. I am now seeing when I have a project area with two team areas and one of the team areas has child team area, I sometimes don't get the right roles for a member in a team area.
This time I'm seeing extra roles being returned for a user in a team area.
Here is the layout of the project/area team roles on RTC:
-Superman
--Superman
---Engineer, Superman
--Engineer
The code returns:
-Superman
--Superman
---Engineer, Superman
--Engineer, Superman
So when I call to get the users role in the last team area, is the code returning roles for both the team area and the project area? Is there a way to get the roles just in the team area?
This time I'm seeing extra roles being returned for a user in a team area.
Here is the layout of the project/area team roles on RTC:
-Superman
--Superman
---Engineer, Superman
--Engineer
The code returns:
-Superman
--Superman
---Engineer, Superman
--Engineer, Superman
So when I call to get the users role in the last team area, is the code returning roles for both the team area and the project area? Is there a way to get the roles just in the team area?
I still see issues getting the right roles for a user. I am now seeing when I have a project area with two team areas and one of the team areas has child team area, I sometimes don't get the right roles for a member in a team area.
This time I'm seeing extra roles being returned for a user in a team area.
Here is the layout of the project/area team roles on RTC:
-Superman
--Superman
---Engineer, Superman
--Engineer
The code returns:
-Superman
--Superman
---Engineer, Superman
--Engineer, Superman
So when I call to get the users role in the last team area, is the code returning roles for both the team area and the project area? Is there a way to get the roles just in the team area?
This is expected that you will get the role assignments from the given area as well as role assignments defined in parent areas. This is how we control the permission and operation behavior based on role assignments.
Can I ask the reason why you need to get the roles only defined in the given area programmatically?
I reverted the code back to what I posted at the top. This gives me the roles assigned for the member of the project/team area. However, I don't always get all the roles assigned. I witnessed when a member is assigned multiple roles, I would only receive one of the roles. I wasn't able to pin down the exact scenario that causes this. If I were to assign the roles again either in our UI or in RTC UI, then all the assigned roles are returned as expected.