1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-28 17:52:43 +01:00
phorge-phorge/src/applications/people/conduit/UserFindConduitAPIMethod.php

41 lines
952 B
PHP
Raw Normal View History

2011-01-24 20:36:53 +01:00
<?php
final class UserFindConduitAPIMethod extends UserConduitAPIMethod {
public function getAPIMethodName() {
return 'user.find';
}
2011-01-24 20:36:53 +01:00
public function getMethodStatus() {
return self::METHOD_STATUS_DEPRECATED;
}
public function getMethodStatusDescription() {
return pht('Obsoleted by "%s".', 'user.query');
}
2011-01-24 20:36:53 +01:00
public function getMethodDescription() {
return pht('Lookup PHIDs by username. Obsoleted by "%s".', 'user.query');
2011-01-24 20:36:53 +01:00
}
protected function defineParamTypes() {
2011-01-24 20:36:53 +01:00
return array(
'aliases' => 'required list<string>',
2011-01-24 20:36:53 +01:00
);
}
protected function defineReturnType() {
2011-01-24 20:36:53 +01:00
return 'nonempty dict<string, phid>';
}
protected function execute(ConduitAPIRequest $request) {
$users = id(new PhabricatorPeopleQuery())
->setViewer($request->getUser())
->withUsernames($request->getValue('aliases', array()))
->execute();
2011-01-24 20:36:53 +01:00
return mpull($users, 'getPHID', 'getUsername');
}
}