Find project area/team area a certain archived user is a member of and remove that user via plain Java API
RTC v4.0.3. used.
The users deleted some users from LDAP and then archived the users in RTC via sync job. Now they need to find out a way to automatically retrieve the project areas/team areas info the archived user is member of and remove them from the PA/TA. According to some posts such as: https://jazz.net/forum/questions/108771/get-user-project-area-and-role-access-using-plain-java-api-rtc, we can print the project areas/team areas the user is a member of. Ralph Schoon's blog has the codes for that as well: https://rsjazz.wordpress.com/2012/12/09/analyzing-a-aroject-areas-members-and-roles-using-the-plain-java-client-libraries/ I have two questions here: 1) Would the codes applied to archived users as well? i.e. can they use the same code to list the project areas and team areas for which the archived user is a member of? 2) if yes, is there any Java API they can use to remove those user(s) from the project area/team area? Appreciate any inputs. |
2 answers
We do something similar. Our code:
1) gets all users in the repository and pulls out those that are archived (using contributor.isArchived()). 2) gets all of the team areas and for each team area, gets the members (teamArea.getMembers()). 3) goes through the members to see if the member is in the list of archivedUsers. We don't programmatically remove them but on the teamArea object, there is a removeMember(iContributorHandle) method that you should be able to use. Susan Comments
Don Yang
commented Mar 24 '14, 1:48 a.m.
Thanks Susan for the prompt info.
IContributor user = teamRepository.loggedInContributor(); // If having an ID for the user as string //IContributor user = teamRepository.contributorManager().fetchContributorByUserId(user) IProcessItemService processItemService = (IProcessItemService) teamRepository .getClientLibrary(IProcessItemService.class); but I am not sure if it will work for archived user or not. I checked IContributorHandle but could not find removeMember(in v405 API doc). I dont know whether I can use removeLoginParticipant(ITeamRepository.ILoginParticipant participant) to remove the archived users in this case.
Susan Hanson
commented Mar 24 '14, 2:40 a.m.
So, a Contributor (to my knowledge) does not know what teams they are on. A team knows what members it has and what role each member has on that team.
Don Yang
commented Mar 24 '14, 6:37 a.m.
The logic sounds good. How about if it is project area's member but not in a team area?
" a Contributor (to my knowledge) does not know what teams they are on. " : from the code "Only Analyze the Process Areas of One User " (below Rapha's blog) it seems that it is possible to get a PA/TA list for a user, though I am asking if that includes the archived users or not. 1
Susan Hanson
commented Mar 24 '14, 6:49 a.m.
I have a report that looks like this (Name, Team name, Role on that team .. delimited by |):
Don Yang
commented Mar 24 '14, 6:29 p.m.
Thank you very much Susan for the further details.
|
Ralph Schoon (63.5k●3●36●46)
| answered Mar 24 '14, 3:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Mar 24 '14, 3:19 a.m.
I think you should find most of the code here: https://rsjazz.wordpress.com/2012/12/09/analyzing-a-aroject-areas-members-and-roles-using-the-plain-java-client-libraries/ go to Only Analyze the Process Areas of One User as a starter.
Comments
Don Yang
commented Mar 24 '14, 6:32 a.m.
Hi, Ralph Thank you very much and yes I am referring to the codes in your blog. Can you please advise whether the code applies to the archived users or not. And if we want to remove the archived users from the project area/team area, what is the method to achieve that? Would removeLoginParticipant(ITeamRepository.ILoginParticipant participant) do the job?
Don 1
sam detweiler
commented Mar 24 '14, 6:40 a.m.
IProcessArea.removeMember
1
In this API it is always important to understand the context of what to do and where.
Ralph Schoon
commented Mar 24 '14, 6:53 a.m.
| edited Mar 24 '14, 6:53 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Archived users: As far as I can tell, an archived user is like any other user. It is only no longer active and has no licenses. However, an archived user might still be member of project areas - I did never play with this. The Archived User has an IContributorHandle and an IContributor object as any other user. So all operations should still apply.
Don Yang
commented Mar 24 '14, 6:29 p.m.
Thanks a lot to Ralph and Sam for the explanation and detailed method.
|
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.