Quantcast
Channel: VMware Communities : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 176483

How to get the groups a user is in

$
0
0

I am trying to get all the groups that a specific user is a member of.

 

I am trying the following:

 

ReferenceType newUserReference = getCommandSession().getUserReferenceByName("user"); //method that gets a ReferenceType object for the desired user using QueryService

User user = getCommandSession().getUserByReference(newUserReference);

for(ReferenceType groupReference : user.getGroupRefs())

{

     System.out.println(groupReference.getName());

}

 

The for loop is never entered, regardless of what user name I specify. I have tried users that are vApp Authors and users that are OrganizationAdministrators. (All my users are in groups, which show up in the group roles section of their properties in the UI).


Viewing all articles
Browse latest Browse all 176483

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>