1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-06 04:41:01 +01:00
phorge-phorge/src/applications/settings/application/PhabricatorApplicationSettings.php
epriestley 0fa411083f Show an "approval queue" item on the home page for admins, and sort out menu item visibility
Summary:
  - If you're an administrator and there are users waiting for approval, show a count on the home page.
  - Sort out the `isUserActivated()` access check.
  - Hide all the menu widgets except "Logout" for disabled and unapproved users.
  - Add a "Log In" item.
  - Add a bunch of unit tests.

Test Plan: Ran unit tests, clicked around as unapproved/approved/logged-in/logged-out users.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, chad

Differential Revision: https://secure.phabricator.com/D7574
2013-11-13 11:24:38 -08:00

54 lines
1.2 KiB
PHP

<?php
final class PhabricatorApplicationSettings extends PhabricatorApplication {
public function getBaseURI() {
return '/settings/';
}
public function getShortDescription() {
return 'User Preferences';
}
public function getIconName() {
return 'settings';
}
public function canUninstall() {
return false;
}
public function getRoutes() {
return array(
'/settings/' => array(
'(?:panel/(?P<key>[^/]+)/)?' => 'PhabricatorSettingsMainController',
'adjust/' => 'PhabricatorSettingsAdjustController',
),
);
}
public function getApplicationGroup() {
return self::GROUP_UTILITIES;
}
public function buildMainMenuItems(
PhabricatorUser $user,
PhabricatorController $controller = null) {
$items = array();
if ($user->isLoggedIn() && $user->isUserActivated()) {
$selected = ($controller instanceof PhabricatorSettingsMainController);
$item = new PHUIListItemView();
$item->setName(pht('Settings'));
$item->setIcon('settings');
$item->addClass('core-menu-item');
$item->setSelected($selected);
$item->setHref('/settings/');
$items[] = $item;
}
return $items;
}
}