mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Start fleshing out PhabricatorAuthProviderViewController
Summary: Ref D20645. Start making this view a little more useful: {F6573605} Test Plan: Mk. 1 eyeball Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D20646
This commit is contained in:
parent
3c43222525
commit
2c435433e0
1 changed files with 80 additions and 0 deletions
|
@ -114,6 +114,86 @@ final class PhabricatorAuthProviderViewController
|
|||
pht('Provider Type'),
|
||||
$config->getProvider()->getProviderName());
|
||||
|
||||
$status = $this->buildStatus($config);
|
||||
$view->addProperty(pht('Status'), $status);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
private function buildStatus(PhabricatorAuthProviderConfig $config) {
|
||||
$viewer = $this->getViewer();
|
||||
$view = id(new PHUIStatusListView())
|
||||
->setViewer($viewer);
|
||||
|
||||
$icon_enabled = PHUIStatusItemView::ICON_ACCEPT;
|
||||
$icon_disabled = PHUIStatusItemView::ICON_REJECT;
|
||||
|
||||
$icon_map = array(
|
||||
true => $icon_enabled,
|
||||
false => $icon_disabled,
|
||||
);
|
||||
|
||||
$color_map = array(
|
||||
true => 'green',
|
||||
false => 'red',
|
||||
);
|
||||
|
||||
$provider = $config->getProvider();
|
||||
|
||||
$view->addItem(
|
||||
id(new PHUIStatusItemView())
|
||||
->setIcon(
|
||||
$icon_map[$config->getIsEnabled()],
|
||||
$color_map[$config->getIsEnabled()])
|
||||
->setTarget(pht('Provider Enabled')));
|
||||
|
||||
$view->addItem(
|
||||
id(new PHUIStatusItemView())
|
||||
->setIcon(
|
||||
$icon_map[$config->getShouldAllowLogin()],
|
||||
$color_map[$config->getShouldAllowLogin()])
|
||||
->setTarget(pht('Allow Logins')));
|
||||
|
||||
$view->addItem(
|
||||
id(new PHUIStatusItemView())
|
||||
->setIcon(
|
||||
$icon_map[$config->getShouldAllowRegistration()],
|
||||
$color_map[$config->getShouldAllowRegistration()])
|
||||
->setTarget(pht('Allow Registration')));
|
||||
|
||||
$view->addItem(
|
||||
id(new PHUIStatusItemView())
|
||||
->setIcon(
|
||||
$icon_map[$config->getShouldAllowLink()],
|
||||
$color_map[$config->getShouldAllowLink()])
|
||||
->setTarget(pht('Allow Account Linking')));
|
||||
|
||||
$view->addItem(
|
||||
id(new PHUIStatusItemView())
|
||||
->setIcon(
|
||||
$icon_map[$config->getShouldAllowUnlink()],
|
||||
$color_map[$config->getShouldAllowUnlink()])
|
||||
->setTarget(pht('Allow Account Unlinking')));
|
||||
|
||||
if ($provider->shouldAllowEmailTrustConfiguration()) {
|
||||
$view->addItem(
|
||||
id(new PHUIStatusItemView())
|
||||
->setIcon(
|
||||
$icon_map[$config->getShouldTrustEmails()],
|
||||
$color_map[$config->getShouldTrustEmails()])
|
||||
->setTarget(pht('Trust Email Addresses')));
|
||||
}
|
||||
|
||||
if ($provider->supportsAutoLogin()) {
|
||||
$view->addItem(
|
||||
id(new PHUIStatusItemView())
|
||||
->setIcon(
|
||||
$icon_map[$config->getShouldAutoLogin()],
|
||||
$color_map[$config->getShouldAutoLogin()])
|
||||
->setTarget(pht('Allow Auto Login')));
|
||||
}
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue