Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php
12256 views
1
<?php
2
3
final class UserWhoAmIConduitAPIMethod extends UserConduitAPIMethod {
4
5
public function getAPIMethodName() {
6
return 'user.whoami';
7
}
8
9
public function getMethodDescription() {
10
return pht('Retrieve information about the logged-in user.');
11
}
12
13
protected function defineParamTypes() {
14
return array();
15
}
16
17
protected function defineReturnType() {
18
return 'nonempty dict<string, wild>';
19
}
20
21
public function getRequiredScope() {
22
return self::SCOPE_ALWAYS;
23
}
24
25
protected function execute(ConduitAPIRequest $request) {
26
$person = id(new PhabricatorPeopleQuery())
27
->setViewer($request->getUser())
28
->needProfileImage(true)
29
->withPHIDs(array($request->getUser()->getPHID()))
30
->executeOne();
31
32
return $this->buildUserInformationDictionary(
33
$person,
34
$with_email = true,
35
$with_availability = false);
36
}
37
38
}
39
40