mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Don't show "registration might be too open" warnings unless an auth provider actually allows registration
Summary: Depends on D20118. Fixes T5351. We possibly raise some warnings about registration (approval queue, email domains), but they aren't relevant if no one can register. Hide these warnings if no providers actually support registration. Test Plan: Viewed the Auth provider list with registration providers and with no registration providers, saw more tailored guidance. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T5351 Differential Revision: https://secure.phabricator.com/D20119
This commit is contained in:
parent
7469075a83
commit
a4bab60ad0
1 changed files with 20 additions and 0 deletions
|
@ -10,6 +10,26 @@ final class PhabricatorAuthProvidersGuidanceEngineExtension
|
|||
}
|
||||
|
||||
public function generateGuidance(PhabricatorGuidanceContext $context) {
|
||||
$configs = id(new PhabricatorAuthProviderConfigQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->withIsEnabled(true)
|
||||
->execute();
|
||||
|
||||
$allows_registration = false;
|
||||
foreach ($configs as $config) {
|
||||
$provider = $config->getProvider();
|
||||
if ($provider->shouldAllowRegistration()) {
|
||||
$allows_registration = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If no provider allows registration, we don't need provide any warnings
|
||||
// about registration being too open.
|
||||
if (!$allows_registration) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$domains_key = 'auth.email-domains';
|
||||
$domains_link = $this->renderConfigLink($domains_key);
|
||||
$domains_value = PhabricatorEnv::getEnvConfig($domains_key);
|
||||
|
|
Loading…
Reference in a new issue