/** * Returns a Person object for person with $id or false on not found * * @throws SocialSpiException * @param UserId $userId * @param GroupId $groupId * @param array $fields Set of contact fields to return, * as array('fieldName' => 'fieldName'). * This looks weird but it's just the way Shindig * passes us the $fields. * If $fields['all'] is set, all known fields are returned. * @param SecurityToken $token * @return array|EmptyResponseItem */ function getPerson($userId, $groupId, $fields, SecurityToken $token) { if (isset($fields["all"])) { $fields = array(); // clear the default fields } if ($userId->getType() != "userId") { throw new SocialSpiException("Relative identifiers such as 'viewer', 'me' or 'owner' not supported! " . "(requested: " . $userId->getType() . ")"); } $identifier = $userId->getUserId($token); $result = $this->_getSocialData()->getPerson($identifier, array_values($fields), isset($_REQUEST['vo']) ? $_REQUEST['vo'] : null, isset($_REQUEST['sp-entity-id']) ? $_REQUEST['sp-entity-id'] : null, isset($_REQUEST['subject-id']) ? $_REQUEST['subject-id'] : null); if (empty($result)) { return new EngineBlock_Shindig_Response_EmptyResponseItem(); } return array($result); }
/** * Tests UserId->getType() */ public function testGetType() { $this->assertEquals('viewer', $this->UserId->getType()); }