How to get the repository roles for all Active Users of Rational Quality Manager
4 answers
This Plain Java client Libraries based code does the trick. This is client API. I assume there is a REST API available for this, but I don't know it. See https://rsjazz.wordpress.com/2015/09/30/learning-to-fly-getting-started-with-the-rtc-java-apis/ for more information. This is client API.
/*********** * Licensed Materials - Property of IBM * (c) Copyright IBM Corporation 2012. All Rights Reserved. * * Note to U.S. Government Users Restricted Rights: Use, duplication or * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. ***********/ package com.ibm.js.team.admin.automation;import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor;
import com.ibm.team.repository.client.ITeamRepository; import com.ibm.team.repository.client.TeamPlatform; import com.ibm.team.repository.common.TeamRepositoryException;
/* * Tool to get the Jazz Repository Role for a User. * / public class GetRepositoryRoles {
/** * Use the separator ; below for CSV files generated with Excel */ // private static final String SEPERATOR = ";"; /** * Main method to call * * @param args */ 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); } /** * Parse the parameters and run the operation * * @param args * @return * @throws TeamRepositoryException */ private static boolean run(String[] args) throws TeamRepositoryException { if (args.length != 4) { System.out .println("Usage: ArchiveUser [repositoryURI] [userId] [password] [targetUserId]"); System.out.println("Examples:"); System.out .println("./GetRepositoryRoles \"https://clm.example.com:9443/jts\" user password \"al\" false"); return false; } String repositoryURI = args[0]; final String userId = args[1]; final String password = args[2]; String lookupID = args[3]; ITeamRepository teamRepository = TeamPlatform .getTeamRepositoryService().getTeamRepository(repositoryURI); teamRepository .registerLoginHandler(new ITeamRepository.ILoginHandler() { public ILoginInfo challenge(ITeamRepository repository) { return new ILoginInfo() { public String getUserId() { return userId; } public String getPassword() { return password; } }; } }); IProgressMonitor monitor = new NullProgressMonitor(); teamRepository.login(monitor); String[] roles = teamRepository.externalUserRegistryManager().fetchGroupsForUser(lookupID, monitor); for (int i = 0; i < roles.length; i++) { System.out.println("Role: " + roles[i]); } teamRepository.logout(); return true; }
}
</pre>
Comments
Davyd,
you can use repotools-qm -exportUsers (or something similar) to get this information.
Comments
Hi Ralph
The repository role information is either maintained by admins or it is in the LDAP system. It is not information a normal user would need to know or need to access.
Basically, I am looking for individual user permission level in profile i.e. Jazz Admin or Jazz Guest or Jazz Project Admin, etc. Somehow I cannot attach screenshot or any attachment.
Comments
I think you are confusing concepts. Please see https://jazz.net/wiki/bin/view/Deployment/RTCProcessFundamentals to understand the concepts and differences of roles and repository roles and update your question.
Ah, there is the disconnect. I usually work on a local system without LDAP.
Ralph