Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F82010
D7574.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D7574.diff
View Options
diff --git a/src/applications/auth/application/PhabricatorApplicationAuth.php b/src/applications/auth/application/PhabricatorApplicationAuth.php
--- a/src/applications/auth/application/PhabricatorApplicationAuth.php
+++ b/src/applications/auth/application/PhabricatorApplicationAuth.php
@@ -41,6 +41,20 @@
->setHref('/logout/')
->setSelected(($controller instanceof PhabricatorLogoutController));
$items[] = $item;
+ } else {
+ if ($controller instanceof PhabricatorAuthController) {
+ // Don't show the "Login" item on auth controllers, since they're
+ // generally all related to logging in anyway.
+ } else {
+ $item = id(new PHUIListItemView())
+ ->addClass('core-menu-item')
+ ->setName(pht('Log In'))
+ // TODO: Login icon?
+ ->setIcon('power')
+ ->setWorkflow(true)
+ ->setHref('/auth/login/');
+ $items[] = $item;
+ }
}
return $items;
diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php
--- a/src/applications/base/controller/PhabricatorController.php
+++ b/src/applications/base/controller/PhabricatorController.php
@@ -74,10 +74,15 @@
}
}
- if ($user->getIsDisabled() && $this->shouldRequireEnabledUser()) {
- $disabled_user_controller = new PhabricatorDisabledUserController(
- $request);
- return $this->delegateToController($disabled_user_controller);
+ if ($this->shouldRequireEnabledUser()) {
+ if ($user->isLoggedIn() && !$user->getIsApproved()) {
+ $controller = new PhabricatorAuthNeedsApprovalController($request);
+ return $this->delegateToController($controller);
+ }
+ if ($user->getIsDisabled()) {
+ $controller = new PhabricatorDisabledUserController($request);
+ return $this->delegateToController($controller);
+ }
}
$event = new PhabricatorEvent(
@@ -120,11 +125,6 @@
return $this->delegateToController($controller);
}
}
- if (!$user->getIsApproved()) {
- $controller = new PhabricatorAuthNeedsApprovalController($request);
- $this->setCurrentApplication($auth_application);
- return $this->delegateToController($controller);
- }
}
// If the user doesn't have access to the application, don't let them use
diff --git a/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php b/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php
--- a/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php
+++ b/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php
@@ -47,6 +47,11 @@
->setUsername('admin')
->save();
+ $u_notapproved = $this->generateNewTestUser()
+ ->setIsApproved(0)
+ ->setUsername('notapproved')
+ ->save();
+
$env = PhabricatorEnv::beginScopedEnv();
$env->overrideEnvConfig('phabricator.base-uri', 'http://'.$host);
$env->overrideEnvConfig('policy.allow-public', false);
@@ -68,6 +73,7 @@
array(
$u_public,
$u_disabled,
+ $u_notapproved,
));
@@ -86,6 +92,7 @@
$u_unverified,
$u_public,
$u_disabled,
+ $u_notapproved,
));
$this->checkAccess(
@@ -100,6 +107,7 @@
array(
$u_public,
$u_disabled,
+ $u_notapproved,
));
$env->overrideEnvConfig('auth.require-email-verification', false);
@@ -118,6 +126,7 @@
$u_unverified,
$u_public,
$u_disabled,
+ $u_notapproved,
));
@@ -132,6 +141,7 @@
$u_unverified,
$u_admin,
$u_disabled,
+ $u_notapproved,
),
array(
$u_public,
@@ -152,6 +162,7 @@
),
array(
$u_disabled,
+ $u_notapproved,
));
@@ -184,6 +195,7 @@
),
array(
$u_disabled,
+ $u_notapproved,
));
$env->overrideEnvConfig('policy.allow-public', false);
@@ -208,6 +220,7 @@
$u_admin,
$u_public,
$u_disabled,
+ $u_notapproved,
));
$this->checkAccess(
@@ -222,6 +235,7 @@
),
array(
$u_disabled,
+ $u_notapproved,
));
}
diff --git a/src/applications/people/application/PhabricatorApplicationPeople.php b/src/applications/people/application/PhabricatorApplicationPeople.php
--- a/src/applications/people/application/PhabricatorApplicationPeople.php
+++ b/src/applications/people/application/PhabricatorApplicationPeople.php
@@ -62,13 +62,39 @@
);
}
+ public function loadStatus(PhabricatorUser $user) {
+ if (!$user->getIsAdmin()) {
+ return array();
+ }
+
+ $need_approval = id(new PhabricatorPeopleQuery())
+ ->setViewer($user)
+ ->withIsApproved(false)
+ ->execute();
+
+ if (!$need_approval) {
+ return array();
+ }
+
+ $status = array();
+
+ $count = count($need_approval);
+ $type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION;
+ $status[] = id(new PhabricatorApplicationStatusView())
+ ->setType($type)
+ ->setText(pht('%d User(s) Need Approval', $count))
+ ->setCount($count);
+
+ return $status;
+ }
+
public function buildMainMenuItems(
PhabricatorUser $user,
PhabricatorController $controller = null) {
$items = array();
- if ($user->isLoggedIn()) {
+ if ($user->isLoggedIn() && $user->isUserActivated()) {
$image = $user->loadProfileImageURI();
$item = new PHUIListItemView();
diff --git a/src/applications/settings/application/PhabricatorApplicationSettings.php b/src/applications/settings/application/PhabricatorApplicationSettings.php
--- a/src/applications/settings/application/PhabricatorApplicationSettings.php
+++ b/src/applications/settings/application/PhabricatorApplicationSettings.php
@@ -37,7 +37,7 @@
$items = array();
- if ($user->isLoggedIn()) {
+ if ($user->isLoggedIn() && $user->isUserActivated()) {
$selected = ($controller instanceof PhabricatorSettingsMainController);
$item = new PHUIListItemView();
$item->setName(pht('Settings'));
diff --git a/src/infrastructure/internationalization/PhabricatorBaseEnglishTranslation.php b/src/infrastructure/internationalization/PhabricatorBaseEnglishTranslation.php
--- a/src/infrastructure/internationalization/PhabricatorBaseEnglishTranslation.php
+++ b/src/infrastructure/internationalization/PhabricatorBaseEnglishTranslation.php
@@ -810,6 +810,11 @@
),
),
+ '%d User(s) Need Approval' => array(
+ '%d User Needs Approval',
+ '%d Users Need Approval',
+ ),
+
);
}
diff --git a/src/view/page/menu/PhabricatorMainMenuView.php b/src/view/page/menu/PhabricatorMainMenuView.php
--- a/src/view/page/menu/PhabricatorMainMenuView.php
+++ b/src/view/page/menu/PhabricatorMainMenuView.php
@@ -44,7 +44,7 @@
$search_button = '';
$app_button = '';
- if ($user->isLoggedIn()) {
+ if ($user->isLoggedIn() && $user->isUserActivated()) {
list($menu, $dropdowns) = $this->renderNotificationMenu();
$alerts[] = $menu;
$menus = array_merge($menus, $dropdowns);
@@ -91,8 +91,11 @@
'helpURI' => '/help/keyboardshortcut/',
);
- $show_search = ($user->isLoggedIn()) ||
- (PhabricatorEnv::getEnvConfig('policy.allow-public'));
+ if ($user->isLoggedIn()) {
+ $show_search = $user->isUserActivated();
+ } else {
+ $show_search = PhabricatorEnv::getEnvConfig('policy.allow-public');
+ }
if ($show_search) {
$search = new PhabricatorMainMenuSearchView();
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/md/lz/bx2mzncf4kq6rt5c
Default Alt Text
D7574.diff (7 KB)
Attached To
Mode
D7574: Show an "approval queue" item on the home page for admins, and sort out menu item visibility
Attached
Detach File
Event Timeline
Log In to Comment