mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-24 13:38:19 +01:00
2cc7f82ece
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
47 lines
1.1 KiB
PHP
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;
|
|
}
|
|
|
|
}
|