Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/people/conduit/UserFindConduitAPIMethod.php
12256 views
1
<?php
2
3
final class UserFindConduitAPIMethod extends UserConduitAPIMethod {
4
5
public function getAPIMethodName() {
6
return 'user.find';
7
}
8
9
public function getMethodStatus() {
10
return self::METHOD_STATUS_DEPRECATED;
11
}
12
13
public function getMethodStatusDescription() {
14
return pht('Obsoleted by "%s".', 'user.query');
15
}
16
17
public function getMethodDescription() {
18
return pht('Lookup PHIDs by username. Obsoleted by "%s".', 'user.query');
19
}
20
21
protected function defineParamTypes() {
22
return array(
23
'aliases' => 'required list<string>',
24
);
25
}
26
27
protected function defineReturnType() {
28
return 'nonempty dict<string, phid>';
29
}
30
31
protected function execute(ConduitAPIRequest $request) {
32
$users = id(new PhabricatorPeopleQuery())
33
->setViewer($request->getUser())
34
->withUsernames($request->getValue('aliases', array()))
35
->execute();
36
37
return mpull($users, 'getPHID', 'getUsername');
38
}
39
40
}
41
42