[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/people/conduit/ -> UserConduitAPIMethod.php (source)

   1  <?php
   2  
   3  abstract class UserConduitAPIMethod extends ConduitAPIMethod {
   4  
   5    final public function getApplication() {
   6      return PhabricatorApplication::getByClass('PhabricatorPeopleApplication');
   7    }
   8  
   9    protected function buildUserInformationDictionary(
  10      PhabricatorUser $user,
  11      PhabricatorCalendarEvent $current_status = null) {
  12  
  13      $roles = array();
  14      if ($user->getIsDisabled()) {
  15        $roles[] = 'disabled';
  16      }
  17      if ($user->getIsSystemAgent()) {
  18        $roles[] = 'agent';
  19      }
  20      if ($user->getIsAdmin()) {
  21        $roles[] = 'admin';
  22      }
  23  
  24      $primary = $user->loadPrimaryEmail();
  25      if ($primary && $primary->getIsVerified()) {
  26        $roles[] = 'verified';
  27      } else {
  28        $roles[] = 'unverified';
  29      }
  30  
  31      if ($user->getIsApproved()) {
  32        $roles[] = 'approved';
  33      }
  34  
  35      if ($user->isUserActivated()) {
  36        $roles[] = 'activated';
  37      }
  38  
  39      $return = array(
  40        'phid'      => $user->getPHID(),
  41        'userName'  => $user->getUserName(),
  42        'realName'  => $user->getRealName(),
  43        'image'     => $user->loadProfileImageURI(),
  44        'uri'       => PhabricatorEnv::getURI('/p/'.$user->getUsername().'/'),
  45        'roles'     => $roles,
  46      );
  47  
  48      if ($current_status) {
  49        $return['currentStatus'] = $current_status->getTextStatus();
  50        $return['currentStatusUntil'] = $current_status->getDateTo();
  51      }
  52  
  53      return $return;
  54    }
  55  
  56  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1