2012-06-13 17:52:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorLDAPUnlinkController extends PhabricatorAuthController {
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
|
|
|
$ldap_info = id(new PhabricatorUserLDAPInfo())->loadOneWhere(
|
|
|
|
'userID = %d',
|
|
|
|
$user->getID());
|
|
|
|
|
|
|
|
if (!$ldap_info) {
|
|
|
|
return new Aphront400Response();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$request->isDialogFormPost()) {
|
|
|
|
$dialog = new AphrontDialogView();
|
|
|
|
$dialog->setUser($user);
|
2013-01-27 01:17:44 +01:00
|
|
|
$dialog->setTitle(pht('Really unlink account?'));
|
2012-06-13 17:52:05 +02:00
|
|
|
$dialog->appendChild(
|
2013-01-27 01:17:44 +01:00
|
|
|
'<p>'.pht('You will not be able to login using this account '.
|
|
|
|
'once you unlink it. Continue?').'</p>');
|
|
|
|
$dialog->addSubmitButton(pht('Unlink Account'));
|
2012-08-13 21:37:26 +02:00
|
|
|
$dialog->addCancelButton('/settings/panel/ldap/');
|
2012-06-13 17:52:05 +02:00
|
|
|
|
|
|
|
return id(new AphrontDialogResponse())->setDialog($dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
$ldap_info->delete();
|
|
|
|
|
|
|
|
return id(new AphrontRedirectResponse())
|
2012-08-13 21:37:26 +02:00
|
|
|
->setURI('/settings/panel/ldap/');
|
2012-06-13 17:52:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|