mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-04 03:41:01 +01:00
86c399b657
Summary: Ref T5655. Some discussion in D9839. Generally speaking, `Phabricator{$name}Application` is clearer than `PhabricatorApplication{$name}`. Test Plan: # Pinned and uninstalled some applications. # Applied patch and performed migrations. # Verified that the pinned applications were still pinned and that the uninstalled applications were still uninstalled. # Performed a sanity check on the database contents. Reviewers: btrahan, epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: hach-que, epriestley, Korvin Maniphest Tasks: T5655 Differential Revision: https://secure.phabricator.com/D9982
57 lines
1.3 KiB
PHP
57 lines
1.3 KiB
PHP
<?php
|
|
|
|
abstract class ConduitAPI_user_Method extends ConduitAPIMethod {
|
|
|
|
public function getApplication() {
|
|
return PhabricatorApplication::getByClass(
|
|
'PhabricatorPeopleApplication');
|
|
}
|
|
|
|
protected function buildUserInformationDictionary(
|
|
PhabricatorUser $user,
|
|
PhabricatorCalendarEvent $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';
|
|
}
|
|
|
|
if ($user->getIsApproved()) {
|
|
$roles[] = 'approved';
|
|
}
|
|
|
|
if ($user->isUserActivated()) {
|
|
$roles[] = 'activated';
|
|
}
|
|
|
|
$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;
|
|
}
|
|
|
|
}
|