Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2694217
D25452.1734773254.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
D25452.1734773254.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D25452: Do not expose Contact Numbers settings panel when no SMS support configured
Attached
Detach File
Event Timeline
Log In to Comment