1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 02:02:40 +01:00

Allow running arc patch without authentication.

Summary:
Allow `arc patch` without authentication if Phabricator instance has
'differential.anonymous-access' set to true.

Test Plan:
Set 'differential.anonymous-access' in Phabricator to true and run `arc patch`
without installing a certificate.  `arc patch` should work as expected.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: 1069
This commit is contained in:
Marek Sapota 2011-11-01 12:34:27 -07:00
parent f1874ddf33
commit 9070a123d3

View file

@ -135,10 +135,6 @@ EOTEXT
($this->getSource() == self::SOURCE_DIFF); ($this->getSource() == self::SOURCE_DIFF);
} }
public function requiresAuthentication() {
return $this->requiresConduit();
}
public function requiresRepositoryAPI() { public function requiresRepositoryAPI() {
return true; return true;
} }
@ -159,6 +155,7 @@ EOTEXT
$source = $this->getSource(); $source = $this->getSource();
$param = $this->getSourceParam(); $param = $this->getSourceParam();
try {
switch ($source) { switch ($source) {
case self::SOURCE_PATCH: case self::SOURCE_PATCH:
if ($param == '-') { if ($param == '-') {
@ -187,6 +184,16 @@ EOTEXT
$param); $param);
break; break;
} }
} catch (Exception $ex) {
if ($ex->getErrorCode() == 'ERR-INVALID-SESSION') {
// Phabricator is not configured to allow anonymos access to
// Differential.
$this->authenticateConduit();
return $this->run();
} else {
throw $ex;
}
}
$repository_api = $this->getRepositoryAPI(); $repository_api = $this->getRepositoryAPI();
if ($repository_api instanceof ArcanistSubversionAPI) { if ($repository_api instanceof ArcanistSubversionAPI) {