/* (non-Javadoc)
@see com.tvd12.ezyfox.core.entities.ApiZone#getUsersInGroup(java.lang.String)
420632
@SuppressWarnings("unchecked")
    @Override
	public <T extends ApiUser> List<T> getUsersInGroup(String groupId) {
	    Collection<User> sfsUsers = getZone().getUsersInGroup(groupId);
	    List<T> anwser = new ArrayList<>();
	    for(User sfsUser : sfsUsers)
	        if(sfsUser.containsProperty(APIKey.USER))
	            anwser.add((T) sfsUser.getProperty(APIKey.USER));
	    return anwser;
	}
539715
public static aaagroup_aaauser_binding[] get(nitro_service service, String groupname) throws Exception{
		aaagroup_aaauser_binding obj = new aaagroup_aaauser_binding();
		obj.set_groupname(groupname);
		aaagroup_aaauser_binding response[] = (aaagroup_aaauser_binding[]) obj.get_resources(service);
		return response;
	}
298149
@Override
    public Iterator findMemberGroups(IEntityGroup group) throws GroupsException {

        if (isTreeRefreshRequired()) {
            refreshTree();
        }

        log.debug("Invoking findMemberGroups() for group:  {}", group.getLocalKey());

        List<IEntityGroup> rslt = new ArrayList<>();

        List<String> list = groupsTree.getChildren().get(group.getLocalKey());
        if (list != null) {
            // should only reach this code if its a SmartLdap managed group...
            for (String s : list) {
                rslt.add(groupsTree.getGroups().get(s));
            }
        }

        return rslt.iterator();
    }
1371104
public UserGroupsResult getGroupList(String username)
            throws APIConnectionException, APIRequestException {
        StringUtils.checkUsername(username);
        ResponseWrapper response = _httpClient.sendGet(_baseUrl + userPath + "/" + username + "/groups");

        return UserGroupsResult.fromResponse(response);
    }
1305132
@Override
    public EntityIdentifier[] searchForGroups(
            final String query,
            final SearchMethod method,
            @SuppressWarnings("unchecked") final Class leaftype) {

        // only search for groups
        if (leaftype != IPerson.class) {
            return new EntityIdentifier[] {};
        }

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Searching Grouper for groups matching query: " + query);
        }

        // result groups.
        List<EntityIdentifier> groups = new ArrayList<EntityIdentifier>();

        try {

            // TODO: searches need to be performed against the group display
            // name rather than the group key

            GcFindGroups groupSearch = new GcFindGroups();
            WsQueryFilter filter = new WsQueryFilter();
            // is this an exact search or fuzzy
            if ((method == SearchMethod.DISCRETE_CI) || (method == SearchMethod.DISCRETE)) {
                filter.setQueryFilterType("FIND_BY_GROUP_NAME_EXACT");
            } else {
                filter.setQueryFilterType("FIND_BY_GROUP_NAME_APPROXIMATE");
            }
            filter.setGroupName(query);
            groupSearch.assignQueryFilter(filter);
            WsFindGroupsResults results = groupSearch.execute();

            if (results != null && results.getGroupResults() != null) {
                for (WsGroup g : results.getGroupResults()) {
                    if (validKey(g.getName())) {
                        if (LOGGER.isTraceEnabled()) {
                            LOGGER.trace("Retrieved group: " + g.getName());
                        }
                        groups.add(new EntityIdentifier(g.getName(), IEntityGroup.class));
                    }
                }
            }

            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Returning " + groups.size() + " results for query " + query);
            }

            return groups.toArray(new EntityIdentifier[groups.size()]);

        } catch (Exception e) {
            LOGGER.warn(
                    "Exception while attempting to retrieve "
                            + "search results for query "
                            + query
                            + " and entity type "
                            + leaftype.getCanonicalName()
                            + " : "
                            + e.getMessage());
            return new EntityIdentifier[] {};
        }
    }
163957
public List<String> getGroups(String username, String property) {
        final List<String> result = new ArrayList<>();
        ldapTemplate.search(query().where("cn").is(username), new AttributesMapper<String>() {
            public String mapFromAttributes(Attributes attrs) throws NamingException {
                NamingEnumeration<?> ous = attrs.get(property).getAll();
                // since we can generate multiple values here but may only return a single string, we ignore
                // the ldapTemplate#search result and just put the values in our own list, returning an empty string
                // which is effectively ignored
                while (ous.hasMore()) {
                    result.add((String) ous.next());
                }
                return "";
            }
        });
        return result;
    }
910716
@Override
    public String[] findMemberGroupKeys(IEntityGroup group) throws GroupsException {
        Connection conn = null;
        Collection groupKeys = new ArrayList();
        String groupKey = null;

        try {
            conn = RDBMServices.getConnection();
            String sql = getFindMemberGroupKeysSql();
            PreparedStatement ps = conn.prepareStatement(sql);
            try {
                ps.setString(1, group.getLocalKey());
                if (LOG.isDebugEnabled())
                    LOG.debug(
                            "RDBMEntityGroupStore.findMemberGroupKeys(): "
                                    + ps
                                    + " ("
                                    + group.getLocalKey()
                                    + ")");
                ResultSet rs = ps.executeQuery();
                try {
                    while (rs.next()) {
                        groupKey = rs.getString(1) + groupNodeSeparator + rs.getString(2);
                        groupKeys.add(groupKey);
                    }
                } finally {
                    rs.close();
                }
            } finally {
                ps.close();
            }
        } catch (Exception sqle) {
            LOG.error("RDBMEntityGroupStore.findMemberGroupKeys(): " + sqle);
            throw new GroupsException("Problem retrieving member group keys: " + sqle);
        } finally {
            RDBMServices.releaseConnection(conn);
        }

        return (String[]) groupKeys.toArray(new String[groupKeys.size()]);
    }
151274
def get_user_groups(user):
    """"""
    if user.is_active and user.is_authenticated():
        if user.is_superuser:
            return TenantGroup.objects.all()
        else:
            return TenantGroup.objects.filter(tenantrole__user=user).distinct()
    else:
        return TenantGroup.objects.none()
645473
@Group
   public final String getGroup()
   {
      if (fullGroupName != null)
      {
         return fullGroupName;
      }
      StringBuilder sb = new StringBuilder();
      if (ownerId != null)
      {
         sb.append(ownerId).append('-');
      }
      return fullGroupName = sb.append(group == null ? id : group).toString();
   }
136455
@Test
    public void getUniqueGroupIdsForUserInNestedGroup() throws Exception {
        // This test will only be executed when using physical LDAP server
        Assume.assumeTrue(!LDAPUtils.USE_LOCAL_LDAP_SERVER);
        String user = getCN() + nestedUser + getSuffix();
        Log.info(logClass, "getUniqueGroupIdsForUserInNestedGroup", "Checking with a valid user.");
        List<String> list = myServlet.getUniqueGroupIdsForUser(user);
        assertTrue(list.contains(getCN() + topGroup + getSuffix()) && list.contains(getCN() + embeddedGroup + getSuffix()));
        assertEquals("There should be two entries", 2, list.size());
    }
91484
@Pure
	public int getPointCountInGroup(int groupIndex) {
		if (groupIndex == 0 && this.pointCoordinates == null) {
			return 0;
		}
		final int firstInGroup = firstInGroup(groupIndex);
		final int lastInGroup = lastInGroup(groupIndex);
		return (lastInGroup - firstInGroup) / 2 + 1;
	}
167778
public String getGroupUsersName(CmsObject cms) {

        try {
            return CmsPrincipal.readPrincipalIncludingHistory(cms, getGroupId()).getName();
        } catch (CmsException e) {
            return getGroupId().toString();
        }
    }
1202058
public UserGroupsEntity getUserGroups(String username) {
		return restClient.get("users/" + username + "/groups", UserGroupsEntity.class,
				new HashMap<String, String>());
	}
389181
@RequestMapping(value = "/{userId}/userGroups", method = RequestMethod.GET)
    public ResponseEntity<Set<UserGroup>> findGroupsOfUser(@PathVariable Integer userId) {

        try {
            Set<UserGroup> userGroupsSet = this.service.getGroupsOfUser(userId);
            return new ResponseEntity<Set<UserGroup>>(userGroupsSet, HttpStatus.OK);
        } catch (Exception e) {
            LOG.error("Error finding user with id " + userId + ": "
                + e.getMessage());
            return new ResponseEntity<Set<UserGroup>>(HttpStatus.NOT_FOUND);
        }
    }
979257
public Map<String, Object> getUser() {
        Map<String, Object> userFields = DDPStateSingleton.getInstance()
                .getDocument("users", getUserId());
        if (userFields != null) {
            return userFields;
        }
        return null;
    }
69128
public java.util.Iterator findParentGroups(IEntityGroup group) throws GroupsException {
        String memberKey = group.getLocalKey();
        String serviceName = group.getServiceName().toString();
        Integer type = EntityTypesLocator.getEntityTypes().getEntityIDFromType(group.getLeafType());
        return findParentGroupsForGroup(serviceName, memberKey, type.intValue());
    }
769920
public Map<String, Group> getGroupsForUser(String userId) {
        ApiResponse response = apiRequest(HttpMethod.GET, null, null,
                organizationId, applicationId, "users", userId, "groups");
        Map<String, Group> groupMap = new HashMap<String, Group>();
        if (response != null) {
            List<Group> groups = response.getEntities(Group.class);
            for (Group group : groups) {
                groupMap.put(group.getPath(), group);
            }
        }
        return groupMap;
    }