1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-24 13:38:19 +01:00
phorge-phorge/src/applications/people/conduit/ConduitAPI_user_Method.php
vrana 2cc7f82ece Move Conduit methods inside applications
Test Plan:
/conduit/
/conduit/method/arcanist.projectinfo/
Call method

  $ echo '{}' | arc call-conduit user.whoami

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4268
2012-12-21 12:21:59 -08:00

47 lines
1.1 KiB
PHP

<?php
/**
* @group conduit
*/
abstract class ConduitAPI_user_Method extends ConduitAPIMethod {
protected function buildUserInformationDictionary(
PhabricatorUser $user,
PhabricatorUserStatus $current_status = null) {
$roles = array();
if ($user->getIsDisabled()) {
$roles[] = 'disabled';
}
if ($user->getIsSystemAgent()) {
$roles[] = 'agent';
}
if ($user->getIsAdmin()) {
$roles[] = 'admin';
}
$primary = $user->loadPrimaryEmail();
if ($primary && $primary->getIsVerified()) {
$roles[] = 'verified';
} else {
$roles[] = 'unverified';
}
$return = array(
'phid' => $user->getPHID(),
'userName' => $user->getUserName(),
'realName' => $user->getRealName(),
'image' => $user->loadProfileImageURI(),
'uri' => PhabricatorEnv::getURI('/p/'.$user->getUsername().'/'),
'roles' => $roles,
);
if ($current_status) {
$return['currentStatus'] = $current_status->getTextStatus();
$return['currentStatusUntil'] = $current_status->getDateTo();
}
return $return;
}
}