Report that shows user memberships
Is there a report that will show for each user what project areas and teams they are a member of?
We have a lot of project areas on our server, and lots of users. Some users are members of more than one project area. I want to be able to know what user <a> is a member of. I haven't been able to find this. repotools -exportUsers is probably where this information could go. It pulls user based information, but it only shows what client access license and repository role (JazzUsers, etc) they are a member of. I would like a report, csv, or something that contains, for each user in a Jazz Team Server:
User name
Repository role (JazzUsers, etc)
User client access license (RTC - Developer, etc)
For each project area the user is a member of:
Has anyone created something like this that could be used as a starting point? Any help would be greatly appreciated.
Thanks!
Steven Tuttle
We have a lot of project areas on our server, and lots of users. Some users are members of more than one project area. I want to be able to know what user <a> is a member of. I haven't been able to find this. repotools -exportUsers is probably where this information could go. It pulls user based information, but it only shows what client access license and repository role (JazzUsers, etc) they are a member of. I would like a report, csv, or something that contains, for each user in a Jazz Team Server:
User name
Repository role (JazzUsers, etc)
User client access license (RTC - Developer, etc)
For each project area the user is a member of:
- Project name
Project area role (Team Member, etc)
For each team in the project the user is a member of:
- Team name
Team role (Team Member, etc)
Has anyone created something like this that could be used as a starting point? Any help would be greatly appreciated.
Thanks!
Steven Tuttle
3 answers
Hi,
the repotools -exportUsers only export the users on a repository level.
I have started to look into traversing one project and dump the users form project area and team area using the Plain Java Client Libaries (or SDK). I am not sure if you could use the data warehouse to get this information.
I can provide you with the experimental code in a separate e-mail.
the repotools -exportUsers only export the users on a repository level.
I have started to look into traversing one project and dump the users form project area and team area using the Plain Java Client Libaries (or SDK). I am not sure if you could use the data warehouse to get this information.
I can provide you with the experimental code in a separate e-mail.
On second thought and since this is the 3rd similar request in 2 days. Here my code:
/*******************************************************************************
* Licensed Materials - Property of IBM
* (c) Copyright IBM Corporation 2008. All Rights Reserved.
*
* AnalyzeProjectContributorsAndRoles
*
* Note to U.S. Government Users Restricted Rights: Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*******************************************************************************/
package com.ibm.team.workitem.ide.ui.example;
import java.net.URI;
import java.util.Iterator;
import java.util.List;
import com.ibm.team.process.client.IClientProcess;
import com.ibm.team.process.client.IProcessClientService;
import com.ibm.team.process.client.IProcessItemService;
import com.ibm.team.process.common.IProcessArea;
import com.ibm.team.process.common.IProjectArea;
import com.ibm.team.process.common.IRole;
import com.ibm.team.process.common.ITeamArea;
import com.ibm.team.process.common.ITeamAreaHandle;
import com.ibm.team.process.common.ITeamAreaHierarchy;
import com.ibm.team.repository.client.IItemManager;
import com.ibm.team.repository.client.ITeamRepository;
import com.ibm.team.repository.client.TeamPlatform;
import com.ibm.team.repository.client.ITeamRepository.ILoginHandler;
import com.ibm.team.repository.client.ITeamRepository.ILoginHandler.ILoginInfo;
import com.ibm.team.repository.common.IContributor;
import com.ibm.team.repository.common.IContributorHandle;
import com.ibm.team.repository.common.TeamRepositoryException;
import com.ibm.team.repository.common.service.IChangeEventService;
import com.ibm.team.repository.transport.client.ITeamRawRestServiceClient;
/**
* Skeleton for a plain-Java client, see
* https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation.
*/
public class AnalyzeProjectContributorsAndRoles {
private static class LoginHandler implements ILoginHandler, ILoginInfo {
private String fUserId;
private String fPassword;
private LoginHandler(String userId, String password) {
fUserId = userId;
fPassword = password;
}
public String getUserId() {
return fUserId;
}
public String getPassword() {
return fPassword;
}
public ILoginInfo challenge(ITeamRepository repository) {
return this;
}
}
public static void main(String[] args) {
boolean result;
TeamPlatform.startup();
try {
result = run(args);
} catch (TeamRepositoryException x) {
x.printStackTrace();
result = false;
} finally {
TeamPlatform.shutdown();
}
if (!result)
System.exit(1);
}
private static boolean run(String[] args) throws TeamRepositoryException {
if (args.length != 4) {
System.out
.println("Usage: PlainJavaClient <repositoryURI> <userId> <password> <projectArea>");
return false;
}
String repositoryURI = args[0];
String userId = args[1];
String password = args[2];
String projectAreaName = args[3];
ITeamRepository teamRepository = TeamPlatform
.getTeamRepositoryService().getTeamRepository(repositoryURI);
teamRepository.registerLoginHandler(new LoginHandler(userId, password));
teamRepository.login(null);
System.out.println("Logged in as: "
+ teamRepository.loggedInContributor().getName());
// your code goes here
IProcessClientService processClient = (IProcessClientService) teamRepository
.getClientLibrary(IProcessClientService.class);
URI uri = URI.create(projectAreaName.replaceAll(" ", "%20"));
IProjectArea projectArea = (IProjectArea) processClient
.findProcessArea(uri, null, null);
if (projectArea == null) {
System.out.println("Project area not found.");
return false;
}
dumpContributors(teamRepository, projectArea);
ITeamAreaHierarchy teamhierarchy = projectArea
.getTeamAreaHierarchySnapshot();
List teamAreas = projectArea.getTeamAreas();
for (Iterator iterator = teamAreas.iterator(); iterator.hasNext();) {
ITeamAreaHandle handle = (ITeamAreaHandle) iterator.next();
ITeamArea teamArea = (ITeamArea) teamRepository.itemManager()
.fetchCompleteItem(handle, IItemManager.DEFAULT, null);
dumpContributors(teamRepository, teamArea);
}
teamRepository.logout();
return true;
}
private static void dumpContributors(ITeamRepository teamRepository,
IProcessArea processArea) throws TeamRepositoryException {
System.out.println("Process Area: " + processArea.getName());
System.out.println("Administrators");
dumpContributors(teamRepository, processArea, processArea
.getAdministrators());
System.out.println("Team Members");
dumpContributors(teamRepository, processArea, processArea.getMembers());
}
private static void dumpContributors(ITeamRepository teamRepository,
IProcessArea processArea, IContributorHandle[] contributors)
throws TeamRepositoryException {
IProcessClientService processClient = (IProcessClientService) teamRepository
.getClientLibrary(IProcessClientService.class);
for (int i = 0; i < contributors.length; i++) {
IContributorHandle handle = (IContributorHandle) contributors[i];
dumpContributor(teamRepository, processArea, handle);
}
}
private static void dumpContributor(ITeamRepository teamRepository,
IProcessArea processArea, IContributorHandle handle)
throws TeamRepositoryException {
IContributor contributor = (IContributor) teamRepository.itemManager()
.fetchCompleteItem(handle, IItemManager.DEFAULT, null);
System.out.print(": " + contributor.getUserId() + "\t"
+ contributor.getName() + "\t" + contributor.getEmailAddress()+ "\t");
IProcessItemService processService = (IProcessItemService) teamRepository
.getClientLibrary(IProcessItemService.class);
IClientProcess process = processService.getClientProcess(processArea,
null);
IRole[] contributorRoles = process.getContributorRoles(contributor,
processArea, null);
for (int j = 0; j < contributorRoles.length; j++) {
IRole role = (IRole) contributorRoles[j];
System.out.print(role.getId() + " ");
}
System.out.println();
}
}