Fetch a user

@param string $guid
@param array $options
@return CollectionDocJson
545631
public function fetchUser($guid, $options = [])
    {
        $options['guid'] = $guid;
        return $this->_request(self::FETCH_USER, $options);
    }
30111
public function deserialize($data, User $user = null, array $options = [])
    {
        if (empty($user)) {
            /** @var User $user */
            $user = $this->om->getRepository(User::class)->findOneBy(['uuid' => $data['id']]);
        }

        return $user;
    }
1198665
public static function retrieve($userId, $id, $options = null)
    {
        return self::_userBasedRetrieve($userId, $id, $options);
    }
918774
public function getListEmployeesManager($guid = null, $limit = CAKE_LDAP_SYNC_AD_LIMIT) {
		$result = [];
		if (!$this->hasField('manager_id')) {
			return $result;
		}

		$conditions = [];
		if (!empty($guid)) {
			$conditions[$this->alias . '.' . CAKE_LDAP_LDAP_ATTRIBUTE_OBJECT_GUID] = $guid;
		}
		$fields = [
			$this->alias . '.id',
			$this->alias . '.manager_id',
			$this->alias . '.' . $this->displayField . ' AS name',
		];
		$order = [
			$this->alias . '.id' => 'asc',
		];
		$this->recursive = -1;
		$data = $this->find('all', compact('fields', 'conditions', 'order', 'limit'));
		if (empty($data)) {
			return $result;
		}

		$result = Hash::combine($data, '{n}.' . $this->alias . '.id', '{n}.' . $this->alias);

		return $result;
	}
703638
public function listCollections(array $options = [])
    {
        $this->setOptions($options);
        $coll = new Collection($this->client, $this->database);
        $coll->setHeaders($this->getHeaders());
        $rs = $coll->getAll();
        $this->checkResponse($rs);
        $colls = array_get($rs, 'DocumentCollections');
        $list = [];
        if (!empty($colls)) {
            foreach ($colls as $coll) {
                $list[] = array_get($coll, 'id');
            }
        }

        return $list;
    }
1109953
public function load(string $type, string $context, $contextId = null, array $options = null)
    {
        $user = null;
        if ($this->tokenStorage->getToken()->getUser() instanceof User) {
            $user = $this->tokenStorage->getToken()->getUser();
        }

        $workspace = null;
        if (DataSource::CONTEXT_WORKSPACE === $context) {
            $workspace = $this->om
                ->getRepository(Workspace::class)
                ->findOneBy(['uuid' => $contextId]);
        }

        /** @var GetDataEvent $event */
        $event = $this->eventDispatcher->dispatch(
            'data_source.'.$type.'.load',
            GetDataEvent::class,
            [$context, $options, $user, $workspace]
        );

        return $event->getData();
    }
195197
public function getData(array $options)
    {
        $provider = $this->getProvider();

        $ownerDetails = $provider->getResourceOwner($this->accessToken);

        $json = $ownerDetails->toArray();

        $data = [
            'externalId' => null,
            'name'       => null,
            'profileUrl' => null,
            'photoUrl'   => null,
            'birthday'   => null,
            'email'      => null,
            'gender'     => null,
            'location'   => null,
            'language'   => null
        ];
        if (isset($json['id']) && $json['id']) {
            $data['externalId'] = $json['id'];
            $data['photoUrl'] = sprintf($this->imageUrlTemplate, $json['id']);
        }
        if (isset($json['name']) && $json['name']) {
            $data['name'] = $json['name'];
        }
        if (isset($json['link']) && $json['link']) {
            $data['profileUrl'] = $json['link'];
        }
        if (isset($json['birthday']) && $json['birthday']) {
            $data['birthday'] = DateTime::createFromFormat('m/d/Y', $json['birthday']);
        }
        if (isset($json['email']) && $json['email']) {
            $data['email'] = $json['email'];
        }
        if (isset($json['gender']) && $json['gender']) {
            $data['gender'] = $json['gender'];
        }
        if (isset($json['location']['name']) && $json['location']['name']) {
            $data['location'] = $json['location']['name'];
        }
        if (isset($json['hometown']['name']) && $json['hometown']['name']) {
            $data['location'] = $json['hometown']['name'];
        }
        if (isset($json['locale']) && $json['locale']) {
            $data['language'] = Locale::getPrimaryLanguage($json['locale']);
        }
        return new Result($data);
    }
679313
public function getUserinfo($uid = null)
	{
		$ret = array();
		if (extension_loaded('posix')) {
			if (is_null($uid)) {
				$uid = posix_geteuid();	// get effective userid
			} elseif (is_string($uid)) {
				// username passed?
				$ret = posix_getpwnam($uid);
			}
			if (empty($ret)) {
				$ret = posix_getpwuid($uid);
			}
			$ret['group'] = posix_getgrgid($uid_info['gid']);
			unset($ret['gid']);	// is inside group array
		}
		return $ret;
	}
875167
public function get($id, $args = [])
    {
        // Fetch all the user properties by default, for convenience.
        if (! isset($args['field']) && ! isset($args['fields'])) {
            $args['fields'] = implode(
                ',',
                array(
                    'ID',
                    'user_login',
                    'display_name',
                    'user_email',
                    'user_registered',
                    'roles',
                    'user_pass',
                    'user_nicename',
                    'user_url',
                    'user_activation_key',
                    'user_status',
                    'url'
                )
            );
        }

        $wpcli_args = buildCLIArgs(
            array(
                'field',
                'fields',
            ),
            $args
        );

        array_unshift($wpcli_args, $id, '--format=json');
        $user = $this->drivers->getDriver()->wpcli('user', 'get', $wpcli_args)['stdout'];
        $user = json_decode($user);

        if (! $user) {
            throw new UnexpectedValueException(sprintf('[W504] Could not find user with ID %d', $id));
        }

        // Convert CSVs to arrays for consistency with WP-PHP driver.
        if (isset($user->roles) && ! is_array($user->roles)) {
            $user->roles = array_map('trim', explode(',', $user->roles));
        }

        return $user;
    }
1044320
public function getUserGroups(string $userId, array $options = []): array
    {
        $query = $this->find('list', [
            'keyField' => 'id',
            'valueField' => 'name'
        ]);
        $query->matching('Users', function ($q) use ($userId) {
            return $q->where(['Users.id' => $userId]);
        });
        $query->applyOptions($options);

        return $query->toArray();
    }
1343794
public function getGuzzleResponseAsJson(
        string $uri,
        array $options = [],
        string $method = GuzzleClientInterface::METHOD_GET
    ): ?array {
        $stringResponse = $this->getGuzzleResponseAsString(
            $uri,
            $options,
            $method
        );

        try {
            return JsonUtils::jsonDecode($stringResponse, true);
        } catch (JsonException $e) {
            throw new GuzzleClientException($e);
        }
    }
940618
public function getNextImage($guid) {
		$imageList = $this->getImageList();
		$key = array_search($guid, $imageList);
		if ($key === false) {
			return null;
		}
		$key++;
		if ($key >= count($imageList)) {
			return get_entity($imageList[0]);
		}
		return get_entity($imageList[$key]);
	}
402251
public function faceGetlist($userId, $groupId, $options=array()){

        $data = array();
        
        $data['user_id'] = $userId;
        $data['group_id'] = $groupId;

        $data = array_merge($data, $options);

        return $this->request($this->faceGetlistUrl, $data);
    }
1284126
public function getStatus(string $guid): array
    {
        // Normalise
        $guid = Uuid::fromString($guid)->toString();

        $key = sprintf('job:%s:status', $guid);

        $status_packet = $this->client->get($key);

        return json_decode($status_packet, true);
    }
194552
public function getCollection(array $options = array())
    {
        /** @var ClientEntity[] $collection */
        $collection = $this->getRepository()->findAll();
        $resource   = new Resource($this->generateBrowseUrl(), array('count' => count($collection)));

        foreach ($collection as $element) {
            $resource->setEmbedded('client', $this->createResourceFromClient($element));
        }

        return $resource;
    }
318366
public function find($uid, array $options = array())
    {
        $query = $this->newQuery($options);
        $query->where('uid', '=', $uid);

        return $query->firstOrFail();
    }
332481
protected function fetchDocumentData($options)
    {
        $documents = $this->dependencyManager->getDocuments($options['orderId'], $options['locale']);
        if (!empty($documents)) {
            /* @var SalesDocument $document */
            foreach ($documents as $document) {
                $data = $document->getSalesDocumentData();
                parent::addEntry(
                    $this->getProperty($data, 'id'),
                    $this->getProperty($data, 'number'),
                    $this->getProperty($data, 'icon'),
                    $this->getProperty($data, 'date'),
                    parent::getRoute($data['id'], $data['type'], 'details'),
                    $this->getProperty($data, 'pdfBaseUrl'),
                    $this->getProperty($data, 'translationKey')
                );
            }
        }
    }