public Map<String, Set<String>> createUserGroupsMap(StackId stackId,
                                                      Cluster cluster, Map<String, DesiredConfig> desiredConfigs) throws AmbariException {
    StackInfo stack = ambariMetaInfo.getStack(stackId.getStackName(), stackId.getStackVersion());
    Map<String, ServiceInfo> servicesMap = ambariMetaInfo.getServices(stack.getName(), stack.getVersion());
    Set<PropertyInfo> stackProperties = ambariMetaInfo.getStackProperties(stack.getName(), stack.getVersion());
    return createUserGroupsMap(cluster, desiredConfigs, servicesMap, stackProperties);
  }
Fetch user to group mapping from the cluster configs. UserGroupEntries contain information regarding the group that the user is associated to.
@param stackId
@param cluster
@param desiredConfigs
@return
@throws AmbariException
ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java