It's all about the answers!

Ask a question

How to get the repository roles for all Active Users of Rational Quality Manager


Khalid Shahzad (50) | asked May 23 '19, 10:05 a.m.
edited Jun 06 '19, 2:04 a.m. by Ralph Schoon (57.1k23642)

How to get Role Type from list of all Active Users report for Rational Quality Manager. I would like to see all users list along with their role type i.e. Either Jazz Admin or Project Admin or User.



4 answers



permanent link
Ralph Schoon (57.1k23642) | answered Jun 05 '19, 3:59 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Jun 05 '19, 4:11 a.m.

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.


I ran it like 

"https://localhost:9443/qm" "myadmin" "myadmin" "ralph"

It returns

Role: JazzAdmins
Role: JazzUsers


The user myadmin needs to have JazzAdmin permissions. I did not try with myadmin having only JazzProjectArea permissions.

String[] roles = teamRepository.externalUserRegistryManager().fetchGroupsForUser(lookupID, monitor);

gets the repository roles.

/***********
 * 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 Norris commented Jun 05 '19, 7:39 p.m.
Fantastic! The Client API will work perfectly!

I'll have to dissect the Java and see if there's an underlying REST call that is part of the Reportable REST API somewhere. If it is, it's not obvious but, as you say, it's got to be web callable somewhere.

Great work Ralph!

Ralph Schoon commented Jun 06 '19, 1:19 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Davyd,


I looked at the REST/OSLC interface. The most obvious hint from the rootservices is https://server/jts/users, but calling that causes a 405. I tried to pass the JSESSINID, but to no avail. I did look into the posts here and did not find anything obvious.

You can try to track what the call above causes, if you want to use the REST interface directly.  I think the API used in https://jazz.net/wiki/bin/view/Deployment/CreateCustomScenarios#Using_the_Plain_Java_Client_Libr is likely a good entry point for debugging. 


permanent link
Ralph Schoon (57.1k23642) | answered May 27 '19, 4:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 you can use repotools-qm -exportUsers (or something similar) to get this information.


Comments
Khalid Shahzad commented May 28 '19, 5:20 a.m. | edited May 28 '19, 5:50 a.m.

 Hi Ralph


Appreciate your response but we are using IBM rational Quality Manager tool as end client user and don't have access to any logs or BE or DB, etc. It's a SaaS for us and web based tool.

is there any other way that we can generate report with Role Type?

Thanks


Ralph Schoon commented May 28 '19, 5:54 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


There are certainly ways to access it e.g. using one of the APIs but nothing out of the box I am aware of that a and user could run.


Davyd Norris commented May 28 '19, 7:43 p.m.
Ralph is correct here, but I was wondering whether you were actually talking about the Jazz role, the assigned CAL, or the Role the user has in terms of the Project Area?

If you are looking for the Jazz roles then, as Ralph said, you can connect to the /pwm LDAP manager page and retrieve user details from there. Note that this will show all users in the LDAP, it won't tell you if they have been archived in Jazz CLM.

permanent link
Khalid Shahzad (50) | answered May 31 '19, 11:32 a.m.

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.


When I click on Manager Users then it gives me list of all users with their Names, User IDs & E-Mail but it does not display Role Type i.e. Jazz Admin or Jazz Guest or Jazz Project Admin, etc. This is what I need too in that list.


Comments
Ralph Schoon commented Jun 03 '19, 2:59 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


In "Manage Users" the repository roles of a user are displayed, if the configuration is correct. The roles are project area specific and can not be displayed there.


Davyd Norris commented Jun 03 '19, 6:49 p.m. | edited Jun 03 '19, 6:51 p.m.
@rschoon - this is not the case for an externally managed directory. You see your own repository role but not any other person's

@ks009 - your best bet is to query the LDAP server directly. I don't know if your SaaS provided LDAP has anonymous read access but you should be able to find out the details of the connection and try it out. Failing that, you may be able to query the web front end and step through the users to pull out the role details.

Ralph Schoon commented Jun 04 '19, 1:41 a.m. | edited Jun 04 '19, 1:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Ah, there is the disconnect. I usually work on a local system without LDAP. 


I am reasonably sure you could use the Jazz Foundation API provided by the RTC Plain Java Client Libraries to get that data. The repotools -exportUsers use that API. I have no examples. Maybe Jim's LDAP synchronizer has more help: https://github.ibm.com/OSLC-Dev/LDAP-RTC-Synchronizer . 

I would assume you need administrative (JazzAdmin) permissions to get at this information for all users.


Davyd Norris commented Jun 04 '19, 7:59 p.m.
Hey Ralph - I actually checked that option via REST before I added my comment and the foundation doesn't expose contributor's LDAP/Jazz groups, only the project area level contributor Roles.

It's actually kind of weird because how else would the apps know that a person is a JazzAdmin?

Perhaps you're right - maybe it's available at the Java Server API level, but then that's not going to help the OP as he is using a SaaS instance and server extensions are a big issue, even for the Enterprise level SaaS option.

permanent link
Khalid Shahzad (50) | answered Jun 03 '19, 10:39 a.m.

 Ralph


No, I am not confusing. I know that from Manager Users, specific Project Based roles cannot be displayed. I am not looking for Project based roles. I am looking for Profile based roles when profiles are created initially i.e. User ID, E-Mail, Full Name and Role Type (Jazz Guest or Jazz Admin or Jazz User) gets selected. And this profile remain same. I need to see this Role Type (Jazz Guest or Jazz Admin or Jazz User) when I click on Manage Users and tool display list of all users with their Full Names, E-Mails and User IDs but not Role Types.

I wish I could attach screenshot here but cannot do so because I get error i.e. in order to attach image or screenshot, you need to have 80 points. Don't know what is this.

Anyway, you can try yourself and you will understand that I am asking and looking for.

Thanks

Your answer


Register or to post your answer.