]> khamidou — GitHub mirrors - arcanist.git/commitdiff
hack up arc patch to not differential.query if its not authenticated
authorBob Trahan <bob.trahan@gmail.com>
Sun, 19 Feb 2012 23:24:03 +0000 (15:24 -0800)
committerBob Trahan <bob.trahan@gmail.com>
Sun, 19 Feb 2012 23:31:16 +0000 (15:31 -0800)
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
src/workflow/patch/ArcanistPatchWorkflow.php

index 9a9df5974d27e304721e5a26fe3ee845afee5871..67e2505afa3adfc465ade89b406a83cbae53cea6 100644 (file)
@@ -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.
index 430f4cdb1c2fd15f894090d0d665fbdaec22fcae..57bd233ddbe27470b4559594da3a381d0cb76e69 100644 (file)
@@ -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(