Returns list of groups for a user.

@param user get groups for this user
@return list of groups for a given user
321178
@Override
  public List<String> getGroups(String user) throws IOException {
    List<String> groups = CommonUtils.getUnixGroups(user);
    // remove duplicated primary group
    return new ArrayList<>(new LinkedHashSet<>(groups));
  }
769501
public Collection<GrantedAuthority> getGrantedAuthorities(DirContextOperations user, String username) {
        String userDn = user.getNameInNamespace();

        if (logger.isDebugEnabled()) {
            logger.debug("Getting authorities for user " + userDn);
        }

        Set<GrantedAuthority> roles = getGroupMembershipRoles(userDn, username);

        Set<GrantedAuthority> extraRoles = getAdditionalRoles(user, username);

        if (extraRoles != null) {
            roles.addAll(extraRoles);
        }

        if (defaultRole != null) {
            roles.add(defaultRole);
        }

        List<GrantedAuthority> result = new ArrayList<GrantedAuthority>(roles.size());
        result.addAll(roles);

        return result;
    }
1250331
def groups(self, user, include=None):
        
        return self._query_zendesk(self.endpoint.groups, 'group', id=user, include=include)
372991
function getUserGroups(user) {
  try {
    const output = runProgram('groups', [user]).trim();
    const groupsText = isBusyboxCommand('groups') ? output : output.split(':')[1].trim();
    return groupsText.split(/\s+/);
  } catch (e) {
    throw new Error(`Cannot resolve user ${user}`);
  }
}
384214
public static List<String> getGroups(String userName, AlluxioConfiguration conf)
      throws IOException {
    GroupMappingService groupMappingService = GroupMappingService.Factory.get(conf);
    return groupMappingService.getGroups(userName);
  }
667829
@Get("/tokens")
    public CompletableFuture<Collection<Token>> listTokens(User loginUser) {
        if (loginUser.isAdmin()) {
            return mds.getTokens()
                      .thenApply(tokens -> tokens.appIds().values());
        } else {
            return mds.getTokens()
                      .thenApply(Tokens::withoutSecret)
                      .thenApply(tokens -> tokens.appIds().values());
        }
    }
217827
public function getGroups(User $user)
    {
        $groups = $user->getPropertyValues(self::PROPERTY_MEMBERS_URI);
        array_walk($groups, function(&$group) { $group = new core_kernel_classes_Resource($group);});
        return $groups;
    }
455496
public GetUserInfoListResponse getUserInfoList(List<UserInfo> userInfoList){
        String url = BASE_API_URL + "cgi-bin/user/info/batchget?access_token=#";
        Map<String, List<UserInfo>> param = new HashMap<String, List<UserInfo>>();
        param.put("user_list", userInfoList);
        BaseResponse r=executePost(url, JSONUtil.toJson(param));
        String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
        GetUserInfoListResponse getUserInfoListResponse=JSONUtil.toBean(resultJson,GetUserInfoListResponse.class);
        return getUserInfoListResponse;
    }
1332206
public boolean isUserAssociatedToGroup(String user, String group)
	{
		if (!isUserExist(user))
		{
			throw new SystemException(String.format("User '%s' does not exist.", user));
		}

		if (!isGroupExist(group))
		{
			throw new SystemException(String.format("Group '%s' does not exist.", group));
		}

		List<String> userGroups = allAssociations.get(user);

		return userGroups != null && userGroups.contains(group);
	}
275123
protected List<CmsUser> getFullUser(List<CmsUser> users) {

        List<CmsUser> res = new ArrayList<CmsUser>();
        for (CmsUser user : users) {
            try {
                res.add(m_cms.readUser(user.getId()));
            } catch (CmsException e) {
                LOG.error("Unable to read user", e);
            }
        }
        return res;
    }
555234
@Programmatic
    public List<PublishedEvent> findRecentByUser(final String user) {
        return repositoryService.allMatches(
                new QueryDefault<>(PublishedEvent.class, "findRecentByUser", "user", user));

    }
651499
public java.util.List<UserProfile> getUserProfiles() {
        if (userProfiles == null) {
            userProfiles = new com.amazonaws.internal.SdkInternalList<UserProfile>();
        }
        return userProfiles;
    }
206358
public static List<String> getCallbackUserRoles(UserGroupCallback userGroupCallback, String userId) {
		List<String> roles = userGroupCallback != null ? userGroupCallback.getGroupsForUser(userId) : new ArrayList<>();
		if (roles == null || roles.isEmpty()) {
			roles = new ArrayList<>();
			roles.add("");
		}

		return roles;
	}
1093349
@Override
    public Set<String> getGroups(String user) throws IOException {
        if (cachedGroups.containsKey(user)) {
            return cachedGroups.get(user);
        }
        Set<String> groups = getUnixGroups(user);
        if (!groups.isEmpty())
            cachedGroups.put(user, groups);
        return groups;
    }
1201323
public UserEntities getUsers() {
		UserEntities userEntities = restClient.get("users", UserEntities.class, new HashMap<String, String>());
		return userEntities;
	}
387414
public UserResources userResources() {
        if (users.get() == null) {
            users.compareAndSet(null, new UserResourcesImpl(this));
        }
        return users.get();
    }
647576
def groupfinder(userid, request):
    
    if userid and hasattr(request, "user") and request.user:
        groups = ["group:%s" % g.id for g in request.user.groups]
        return groups
    return []