Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/application/PhabricatorPeopleApplication.php
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | protected function getCustomCapabilities() { | ||||
return array( | return array( | ||||
PeopleCreateUsersCapability::CAPABILITY => array( | PeopleCreateUsersCapability::CAPABILITY => array( | ||||
'default' => PhabricatorPolicies::POLICY_ADMIN, | 'default' => PhabricatorPolicies::POLICY_ADMIN, | ||||
), | ), | ||||
PeopleBrowseUserDirectoryCapability::CAPABILITY => array(), | PeopleBrowseUserDirectoryCapability::CAPABILITY => array(), | ||||
); | ); | ||||
} | } | ||||
public function loadStatus(PhabricatorUser $user) { | |||||
if (!$user->getIsAdmin()) { | |||||
return array(); | |||||
} | |||||
$limit = self::MAX_STATUS_ITEMS; | |||||
$need_approval = id(new PhabricatorPeopleQuery()) | |||||
->setViewer($user) | |||||
->withIsApproved(false) | |||||
->withIsDisabled(false) | |||||
->setLimit($limit) | |||||
->execute(); | |||||
if (!$need_approval) { | |||||
return array(); | |||||
} | |||||
$status = array(); | |||||
$count = count($need_approval); | |||||
if ($count >= $limit) { | |||||
$count_str = pht( | |||||
'%s+ User(s) Need Approval', | |||||
new PhutilNumber($limit - 1)); | |||||
} else { | |||||
$count_str = pht( | |||||
'%s User(s) Need Approval', | |||||
new PhutilNumber($count)); | |||||
} | |||||
$type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION; | |||||
$status[] = id(new PhabricatorApplicationStatusView()) | |||||
->setType($type) | |||||
->setText($count_str) | |||||
->setCount($count); | |||||
return $status; | |||||
} | |||||
public function getApplicationSearchDocumentTypes() { | public function getApplicationSearchDocumentTypes() { | ||||
return array( | return array( | ||||
PhabricatorPeopleUserPHIDType::TYPECONST, | PhabricatorPeopleUserPHIDType::TYPECONST, | ||||
); | ); | ||||
} | } | ||||
} | } |