public function getPeople($userId, $groupId, CollectionOptions $options, $fields, SecurityToken $token) { $sortOrder = $options->getSortOrder(); $filter = $options->getFilterBy(); $filterOp = $options->getFilterOperation(); $filterValue = $options->getFilterValue(); $first = $options->getStartIndex(); $max = $options->getCount(); $networkDistance = $options->getNetworkDistance(); $ids = $this->getIdSet($userId, $groupId, $token); $allPeople = $this->getAllPeople(); if ($filter == "@friends" && $filterOp == "contains" && isset($filterValue)) { if ($options->getFilterValue() == '@viewer') { $filterValue = $token->getViewerId(); } elseif ($options->getFilterValue() == '@owner') { $filterValue = $token->getOwnerId(); } $ids = $this->getMutualFriends($ids, $filterValue); } if (!$token->isAnonymous() && $filter == "hasApp") { $appId = $token->getAppId(); $peopleWithApp = $this->getPeopleWithApp($appId); } $people = array(); foreach ($ids as $id) { if ($filter == "hasApp" && !in_array($id, $peopleWithApp)) { continue; } $person = null; if (is_array($allPeople) && isset($allPeople[$id])) { $person = $allPeople[$id]; if (!$token->isAnonymous() && $id == $token->getViewerId()) { $person['isViewer'] = true; } if (!$token->isAnonymous() && $id == $token->getOwnerId()) { $person['isOwner'] = true; } $people[] = $person; } } if ($sortOrder == 'name') { usort($people, array($this, 'comparator')); } try { $people = $this->filterResults($people, $options); } catch (Exception $e) { $people['filtered'] = 'false'; } if ($fields) { $people = self::adjustFields($people, $fields); } //TODO: The samplecontainer doesn't support any filters yet. We should fix this. $totalSize = count($people); $collection = new RestfulCollection($people, $options->getStartIndex(), $totalSize); $collection->setItemsPerPage($options->getCount()); return $collection; }