Page MenuHomePhabricator

D19822.id47336.diff
No OneTemporary

D19822.id47336.diff

diff --git a/src/aphront/handler/PhabricatorPolicyRequestExceptionHandler.php b/src/aphront/handler/PhabricatorPolicyRequestExceptionHandler.php
--- a/src/aphront/handler/PhabricatorPolicyRequestExceptionHandler.php
+++ b/src/aphront/handler/PhabricatorPolicyRequestExceptionHandler.php
@@ -83,6 +83,18 @@
$dialog->appendList($list);
}
+ // If the install is in developer mode, include a stack trace for the
+ // exception. When debugging things, it isn't always obvious where a
+ // policy exception came from and this can make it easier to hunt down
+ // bugs or improve ambiguous/confusing messaging.
+
+ $is_developer = PhabricatorEnv::getEnvConfig('phabricator.developer-mode');
+ if ($is_developer) {
+ $dialog->appendChild(
+ id(new AphrontStackTraceView())
+ ->setTrace($throwable->getTrace()));
+ }
+
if ($request->isAjax()) {
$dialog->addCancelButton('/', pht('Close'));
} else {
diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php
--- a/src/applications/base/PhabricatorApplication.php
+++ b/src/applications/base/PhabricatorApplication.php
@@ -545,7 +545,7 @@
case PhabricatorPolicyCapability::CAN_VIEW:
return $this->canUninstall();
case PhabricatorPolicyCapability::CAN_EDIT:
- return false;
+ return true;
default:
$spec = $this->getCustomCapabilitySpecification($capability);
return idx($spec, 'edit', true);
diff --git a/src/applications/config/editor/PhabricatorConfigEditor.php b/src/applications/config/editor/PhabricatorConfigEditor.php
--- a/src/applications/config/editor/PhabricatorConfigEditor.php
+++ b/src/applications/config/editor/PhabricatorConfigEditor.php
@@ -118,7 +118,8 @@
PhabricatorUser $user,
PhabricatorConfigEntry $config_entry,
$value,
- PhabricatorContentSource $source) {
+ PhabricatorContentSource $source,
+ $acting_as_phid = null) {
$xaction = id(new PhabricatorConfigTransaction())
->setTransactionType(PhabricatorConfigTransaction::TYPE_EDIT)
@@ -133,6 +134,10 @@
->setContinueOnNoEffect(true)
->setContentSource($source);
+ if ($acting_as_phid) {
+ $editor->setActingAsPHID($acting_as_phid);
+ }
+
$editor->applyTransactions($config_entry, array($xaction));
}
diff --git a/src/applications/meta/xactions/PhabricatorApplicationPolicyChangeTransaction.php b/src/applications/meta/xactions/PhabricatorApplicationPolicyChangeTransaction.php
--- a/src/applications/meta/xactions/PhabricatorApplicationPolicyChangeTransaction.php
+++ b/src/applications/meta/xactions/PhabricatorApplicationPolicyChangeTransaction.php
@@ -35,11 +35,20 @@
$editor = $this->getEditor();
$content_source = $editor->getContentSource();
+
+ // NOTE: We allow applications to have custom edit policies, but they are
+ // currently stored in the Config application. The ability to edit Config
+ // values is always restricted to administrators, today. Empower this
+ // particular edit to punch through possible stricter policies, so normal
+ // users can change application configuration if the application allows
+ // them to do so.
+
PhabricatorConfigEditor::storeNewValue(
- $user,
+ PhabricatorUser::getOmnipotentUser(),
$config_entry,
$current_value,
- $content_source);
+ $content_source,
+ $user->getPHID());
}
public function getTitle() {
diff --git a/src/applications/meta/xactions/PhabricatorApplicationUninstallTransaction.php b/src/applications/meta/xactions/PhabricatorApplicationUninstallTransaction.php
--- a/src/applications/meta/xactions/PhabricatorApplicationUninstallTransaction.php
+++ b/src/applications/meta/xactions/PhabricatorApplicationUninstallTransaction.php
@@ -43,11 +43,15 @@
$editor = $this->getEditor();
$content_source = $editor->getContentSource();
+
+ // Today, changing config requires "Administrator", but "Can Edit" on
+ // applications to let you uninstall them may be granted to any user.
PhabricatorConfigEditor::storeNewValue(
- $user,
+ PhabricatorUser::getOmnipotentUser(),
$config_entry,
$list,
- $content_source);
+ $content_source,
+ $user->getPHID());
}
public function getTitle() {

File Metadata

Mime Type
text/plain
Expires
Mon, May 13, 9:29 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6288334
Default Alt Text
D19822.id47336.diff (4 KB)

Event Timeline