Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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.



0 votes



4 answers

Permanent link

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>

1 vote

Comments
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!

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

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

0 votes

Comments

 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

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.

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

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.

0 votes

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.


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.

@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.

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.

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

 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

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: May 23 '19, 10:05 a.m.

Question was seen: 2,922 times

Last updated: Jun 06 '19, 2:04 a.m.

Confirmation Cancel Confirm