From 298ed9cda55d90b755e4dc45d202213e91631888 Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Sun, 19 Feb 2012 15:24:03 -0800 Subject: [PATCH] hack up arc patch to not differential.query if its not authenticated Summary: 'cuz the method would fail without authentication! see D1604 for some discussion on approaches here Test Plan: ran arc patch and it worked Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley, johnduhart Maniphest Tasks: T856 Differential Revision: https://secure.phabricator.com/D1645 --- src/workflow/base/ArcanistBaseWorkflow.php | 12 ++++++++++-- src/workflow/patch/ArcanistPatchWorkflow.php | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/workflow/base/ArcanistBaseWorkflow.php b/src/workflow/base/ArcanistBaseWorkflow.php index 9a9df597..67e2505a 100644 --- a/src/workflow/base/ArcanistBaseWorkflow.php +++ b/src/workflow/base/ArcanistBaseWorkflow.php @@ -158,7 +158,7 @@ abstract class ArcanistBaseWorkflow { * @task conduit */ final public function setConduitCredentials(array $credentials) { - if ($this->conduitAuthenticated) { + if ($this->isConduitAuthenticated()) { throw new Exception( "You may not set new credentials after authenticating conduit."); } @@ -196,7 +196,7 @@ abstract class ArcanistBaseWorkflow { * @task conduit */ final public function authenticateConduit() { - if ($this->conduitAuthenticated) { + if ($this->isConduitAuthenticated()) { return $this; } @@ -258,6 +258,14 @@ abstract class ArcanistBaseWorkflow { return $this; } + /** + * @return bool True if conduit is authenticated, false otherwise. + * @task conduit + */ + final protected function isConduitAuthenticated() { + return (bool) $this->conduitAuthenticated; + } + /** * Override this to return true if your workflow requires a conduit channel. diff --git a/src/workflow/patch/ArcanistPatchWorkflow.php b/src/workflow/patch/ArcanistPatchWorkflow.php index 430f4cdb..57bd233d 100644 --- a/src/workflow/patch/ArcanistPatchWorkflow.php +++ b/src/workflow/patch/ArcanistPatchWorkflow.php @@ -770,6 +770,12 @@ EOTEXT } private function loadRevisionFromHash($hash) { + // TODO -- de-hack this as permissions become more clear with things + // like T848 (add scope to OAuth) + if (!$this->isConduitAuthenticated()) { + return null; + } + $conduit = $this->getConduit(); $revisions = $conduit->callMethodSynchronous( -- 2.43.0