1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-25 16:22:42 +01:00

Deprecate ArcanistBaseWorkflow::getUserGUID in favor of "PHID"

Summary: One day all "GUID" references will be gone, maybe.
Test Plan: grep, ran workflow before changing and got a warning about
deprecation
Reviewed By: aran
Reviewers: mgummelt, tuomaspelkonen, aran, jungejason
CC: aran
Differential Revision: 671
This commit is contained in:
epriestley 2011-07-15 12:44:03 -07:00
parent 41b23519e6
commit 8150fdf044
6 changed files with 28 additions and 18 deletions

View file

@ -34,7 +34,7 @@
* and/or @{method:authenticateConduit} later in a workflow to upgrade it. * and/or @{method:authenticateConduit} later in a workflow to upgrade it.
* Once a conduit is open, you can access the client by calling * Once a conduit is open, you can access the client by calling
* @{method:getConduit}, which allows you to invoke methods. You can get * @{method:getConduit}, which allows you to invoke methods. You can get
* verified information about the user identity by calling @{method:getUserGUID} * verified information about the user identity by calling @{method:getUserPHID}
* or @{method:getUserName} after authentication occurs. * or @{method:getUserName} after authentication occurs.
* *
* @task conduit Conduit * @task conduit Conduit
@ -47,7 +47,7 @@ class ArcanistBaseWorkflow {
private $conduitCredentials; private $conduitCredentials;
private $conduitAuthenticated; private $conduitAuthenticated;
private $userGUID; private $userPHID;
private $userName; private $userName;
private $repositoryAPI; private $repositoryAPI;
private $workingCopy; private $workingCopy;
@ -175,7 +175,7 @@ class ArcanistBaseWorkflow {
* - ##certificate## (required) The Conduit certificate to use. * - ##certificate## (required) The Conduit certificate to use.
* - ##description## (optional) Description of the invoking command. * - ##description## (optional) Description of the invoking command.
* *
* Successful authentication allows you to call @{method:getUserGUID} and * Successful authentication allows you to call @{method:getUserPHID} and
* @{method:getUserName}, as well as use the client you access with * @{method:getUserName}, as well as use the client you access with
* @{method:getConduit} to make authenticated calls. * @{method:getConduit} to make authenticated calls.
* *
@ -240,7 +240,7 @@ class ArcanistBaseWorkflow {
} }
$this->userName = $user; $this->userName = $user;
$this->userGUID = $connection['userPHID']; $this->userPHID = $connection['userPHID'];
$this->conduitAuthenticated = true; $this->conduitAuthenticated = true;
@ -280,20 +280,29 @@ class ArcanistBaseWorkflow {
/** /**
* Returns the PHID for the user once they've authenticated via Conduit. * Returns the PHID for the user once they've authenticated via Conduit.
* *
* NOTE: This method will be deprecated and renamed to ##getUserPHID()## at
* some point.
*
* @return phid Authenticated user PHID. * @return phid Authenticated user PHID.
* @task conduit * @task conduit
*/ */
final public function getUserGUID() { final public function getUserPHID() {
if (!$this->userGUID) { if (!$this->userPHID) {
$workflow = get_class($this); $workflow = get_class($this);
throw new Exception( throw new Exception(
"This workflow ('{$workflow}') requires authentication, override ". "This workflow ('{$workflow}') requires authentication, override ".
"requiresAuthentication() to return true."); "requiresAuthentication() to return true.");
} }
return $this->userGUID; return $this->userPHID;
}
/**
* Deprecated. See @{method:getUserPHID}.
*
* @deprecated
*/
final public function getUserGUID() {
phutil_deprecated(
'ArcanistBaseWorkflow::getUserGUID',
'This method has been renamed to getUserPHID().');
return $this->getUserPHID();
} }
/** /**
@ -391,8 +400,8 @@ class ArcanistBaseWorkflow {
$workflow->setRepositoryAPI($this->repositoryAPI); $workflow->setRepositoryAPI($this->repositoryAPI);
} }
if ($this->userGUID) { if ($this->userPHID) {
$workflow->userGUID = $this->getUserGUID(); $workflow->userPHID = $this->getUserPHID();
$workflow->userName = $this->getUserName(); $workflow->userName = $this->getUserName();
} }

View file

@ -19,6 +19,7 @@ phutil_require_module('phutil', 'conduit/client');
phutil_require_module('phutil', 'console'); phutil_require_module('phutil', 'console');
phutil_require_module('phutil', 'filesystem'); phutil_require_module('phutil', 'filesystem');
phutil_require_module('phutil', 'future/exec'); phutil_require_module('phutil', 'future/exec');
phutil_require_module('phutil', 'moduleutils');
phutil_require_module('phutil', 'utils'); phutil_require_module('phutil', 'utils');

View file

@ -73,7 +73,7 @@ EOTEXT
array( array(
'query' => 'committable', 'query' => 'committable',
'guids' => array( 'guids' => array(
$this->getUserGUID(), $this->getUserPHID(),
), ),
)); ));

View file

@ -302,7 +302,7 @@ EOTEXT
'repositoryUUID' => $repo_uuid, 'repositoryUUID' => $repo_uuid,
'creationMethod' => 'arc', 'creationMethod' => 'arc',
'arcanistProject' => $working_copy->getProjectID(), 'arcanistProject' => $working_copy->getProjectID(),
'authorPHID' => $this->getUserGUID(), 'authorPHID' => $this->getUserPHID(),
); );
$diff_info = $conduit->callMethodSynchronous( $diff_info = $conduit->callMethodSynchronous(
@ -493,7 +493,7 @@ EOTEXT
$result = $future->resolve(); $result = $future->resolve();
echo "Updated an existing Differential revision:\n"; echo "Updated an existing Differential revision:\n";
} else { } else {
$revision['user'] = $this->getUserGUID(); $revision['user'] = $this->getUserPHID();
$future = $conduit->callMethod( $future = $conduit->callMethod(
'differential.createrevision', 'differential.createrevision',
$revision); $revision);
@ -955,7 +955,7 @@ EOTEXT
if (!phutil_console_confirm($message)) { if (!phutil_console_confirm($message)) {
throw new ArcanistUsageException('Specify reviewers and retry.'); throw new ArcanistUsageException('Specify reviewers and retry.');
} }
} else if (in_array($this->getUserGUID(), $reviewers)) { } else if (in_array($this->getUserPHID(), $reviewers)) {
throw new ArcanistUsageException( throw new ArcanistUsageException(
"You can not be a reviewer for your own revision."); "You can not be a reviewer for your own revision.");
} }

View file

@ -52,7 +52,7 @@ EOTEXT
$revision_future = $conduit->callMethod( $revision_future = $conduit->callMethod(
'differential.find', 'differential.find',
array( array(
'guids' => array($this->getUserGUID()), 'guids' => array($this->getUserPHID()),
'query' => 'open', 'query' => 'open',
)); ));

View file

@ -69,7 +69,7 @@ EOTEXT
array( array(
'query' => 'committable', 'query' => 'committable',
'guids' => array( 'guids' => array(
$this->getUserGUID(), $this->getUserPHID(),
), ),
)); ));