mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
Surface a better warning when the LDAP extension is not installed
Summary: Fixes T3347. We can't really do this one as a config thing since we don't know if the user wants to use LDAP. Instead, just give them a better message than they otherwise get when they try to install/configure/use LDAP. Test Plan: Faked it and got a reasonable message. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T3347 Differential Revision: https://secure.phabricator.com/D10260
This commit is contained in:
parent
c740d554f6
commit
ef0460c1ff
2 changed files with 16 additions and 0 deletions
|
@ -15,6 +15,8 @@ final class PhabricatorAuthManagementLDAPWorkflow
|
||||||
$console = PhutilConsole::getConsole();
|
$console = PhutilConsole::getConsole();
|
||||||
$console->getServer()->setEnableLog(true);
|
$console->getServer()->setEnableLog(true);
|
||||||
|
|
||||||
|
PhabricatorLDAPAuthProvider::assertLDAPExtensionInstalled();
|
||||||
|
|
||||||
$provider = PhabricatorLDAPAuthProvider::getLDAPProvider();
|
$provider = PhabricatorLDAPAuthProvider::getLDAPProvider();
|
||||||
if (!$provider) {
|
if (!$provider) {
|
||||||
$console->writeOut(
|
$console->writeOut(
|
||||||
|
|
|
@ -251,12 +251,26 @@ final class PhabricatorLDAPAuthProvider extends PhabricatorAuthProvider {
|
||||||
return array($errors, $issues, $values);
|
return array($errors, $issues, $values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function assertLDAPExtensionInstalled() {
|
||||||
|
if (!function_exists('ldap_bind')) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'Before you can set up or use LDAP, you need to install the PHP '.
|
||||||
|
'LDAP extension. It is not currently installed, so PHP can not '.
|
||||||
|
'talk to LDAP. Usually you can install it with '.
|
||||||
|
'`yum install php-ldap`, `apt-get install php5-ldap`, or a '.
|
||||||
|
'similar package manager command.'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function extendEditForm(
|
public function extendEditForm(
|
||||||
AphrontRequest $request,
|
AphrontRequest $request,
|
||||||
AphrontFormView $form,
|
AphrontFormView $form,
|
||||||
array $values,
|
array $values,
|
||||||
array $issues) {
|
array $issues) {
|
||||||
|
|
||||||
|
self::assertLDAPExtensionInstalled();
|
||||||
|
|
||||||
$labels = $this->getPropertyLabels();
|
$labels = $this->getPropertyLabels();
|
||||||
|
|
||||||
$captions = array(
|
$captions = array(
|
||||||
|
|
Loading…
Reference in a new issue