Page MenuHomePhorge

D25452.1734773254.diff
No OneTemporary

D25452.1734773254.diff

diff --git a/src/applications/auth/editor/PhabricatorAuthContactNumberEditEngine.php b/src/applications/auth/editor/PhabricatorAuthContactNumberEditEngine.php
--- a/src/applications/auth/editor/PhabricatorAuthContactNumberEditEngine.php
+++ b/src/applications/auth/editor/PhabricatorAuthContactNumberEditEngine.php
@@ -70,6 +70,18 @@
return $object->getURI();
}
+ /**
+ * Who can create "Contact Numbers" in their Personal Settings;
+ * Nobody if SMS support is not configured in Phorge.
+ */
+ protected function getCreateNewObjectPolicy() {
+ $SMSAuthFactor = new PhabricatorSMSAuthFactor();
+ if ($SMSAuthFactor->isSMSMailerConfigured()) {
+ return PhabricatorPolicies::POLICY_USER;
+ }
+ return PhabricatorPolicies::POLICY_NOONE;
+ }
+
protected function buildCustomEditFields($object) {
return array(
id(new PhabricatorTextEditField())
diff --git a/src/applications/auth/factor/PhabricatorSMSAuthFactor.php b/src/applications/auth/factor/PhabricatorSMSAuthFactor.php
--- a/src/applications/auth/factor/PhabricatorSMSAuthFactor.php
+++ b/src/applications/auth/factor/PhabricatorSMSAuthFactor.php
@@ -334,7 +334,7 @@
return $value;
}
- private function isSMSMailerConfigured() {
+ public function isSMSMailerConfigured() {
$mailers = PhabricatorMetaMTAMail::newMailers(
array(
'outbound' => true,
diff --git a/src/applications/settings/panel/PhabricatorContactNumbersSettingsPanel.php b/src/applications/settings/panel/PhabricatorContactNumbersSettingsPanel.php
--- a/src/applications/settings/panel/PhabricatorContactNumbersSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorContactNumbersSettingsPanel.php
@@ -19,6 +19,18 @@
return PhabricatorSettingsAuthenticationPanelGroup::PANELGROUPKEY;
}
+ /**
+ * Whether to display "Contact Numbers" panel in users' Personal
+ * Settings by checking if SMS support is configured in Phorge
+ */
+ public function isUserPanel() {
+ $SMSAuthFactor = new PhabricatorSMSAuthFactor();
+ if ($SMSAuthFactor->isSMSMailerConfigured()) {
+ return true;
+ }
+ return false;
+ }
+
public function isMultiFactorEnrollmentPanel() {
return true;
}

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 09:27 (5 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1024493
Default Alt Text
D25452.1734773254.diff (2 KB)

Event Timeline