mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 06:42:41 +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:
parent
41b23519e6
commit
8150fdf044
6 changed files with 28 additions and 18 deletions
|
@ -34,7 +34,7 @@
|
|||
* and/or @{method:authenticateConduit} later in a workflow to upgrade it.
|
||||
* Once a conduit is open, you can access the client by calling
|
||||
* @{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.
|
||||
*
|
||||
* @task conduit Conduit
|
||||
|
@ -47,7 +47,7 @@ class ArcanistBaseWorkflow {
|
|||
private $conduitCredentials;
|
||||
private $conduitAuthenticated;
|
||||
|
||||
private $userGUID;
|
||||
private $userPHID;
|
||||
private $userName;
|
||||
private $repositoryAPI;
|
||||
private $workingCopy;
|
||||
|
@ -175,7 +175,7 @@ class ArcanistBaseWorkflow {
|
|||
* - ##certificate## (required) The Conduit certificate to use.
|
||||
* - ##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:getConduit} to make authenticated calls.
|
||||
*
|
||||
|
@ -240,7 +240,7 @@ class ArcanistBaseWorkflow {
|
|||
}
|
||||
|
||||
$this->userName = $user;
|
||||
$this->userGUID = $connection['userPHID'];
|
||||
$this->userPHID = $connection['userPHID'];
|
||||
|
||||
$this->conduitAuthenticated = true;
|
||||
|
||||
|
@ -280,20 +280,29 @@ class ArcanistBaseWorkflow {
|
|||
/**
|
||||
* 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.
|
||||
* @task conduit
|
||||
*/
|
||||
final public function getUserGUID() {
|
||||
if (!$this->userGUID) {
|
||||
final public function getUserPHID() {
|
||||
if (!$this->userPHID) {
|
||||
$workflow = get_class($this);
|
||||
throw new Exception(
|
||||
"This workflow ('{$workflow}') requires authentication, override ".
|
||||
"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);
|
||||
}
|
||||
|
||||
if ($this->userGUID) {
|
||||
$workflow->userGUID = $this->getUserGUID();
|
||||
if ($this->userPHID) {
|
||||
$workflow->userPHID = $this->getUserPHID();
|
||||
$workflow->userName = $this->getUserName();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ phutil_require_module('phutil', 'conduit/client');
|
|||
phutil_require_module('phutil', 'console');
|
||||
phutil_require_module('phutil', 'filesystem');
|
||||
phutil_require_module('phutil', 'future/exec');
|
||||
phutil_require_module('phutil', 'moduleutils');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ EOTEXT
|
|||
array(
|
||||
'query' => 'committable',
|
||||
'guids' => array(
|
||||
$this->getUserGUID(),
|
||||
$this->getUserPHID(),
|
||||
),
|
||||
));
|
||||
|
||||
|
|
|
@ -302,7 +302,7 @@ EOTEXT
|
|||
'repositoryUUID' => $repo_uuid,
|
||||
'creationMethod' => 'arc',
|
||||
'arcanistProject' => $working_copy->getProjectID(),
|
||||
'authorPHID' => $this->getUserGUID(),
|
||||
'authorPHID' => $this->getUserPHID(),
|
||||
);
|
||||
|
||||
$diff_info = $conduit->callMethodSynchronous(
|
||||
|
@ -493,7 +493,7 @@ EOTEXT
|
|||
$result = $future->resolve();
|
||||
echo "Updated an existing Differential revision:\n";
|
||||
} else {
|
||||
$revision['user'] = $this->getUserGUID();
|
||||
$revision['user'] = $this->getUserPHID();
|
||||
$future = $conduit->callMethod(
|
||||
'differential.createrevision',
|
||||
$revision);
|
||||
|
@ -955,7 +955,7 @@ EOTEXT
|
|||
if (!phutil_console_confirm($message)) {
|
||||
throw new ArcanistUsageException('Specify reviewers and retry.');
|
||||
}
|
||||
} else if (in_array($this->getUserGUID(), $reviewers)) {
|
||||
} else if (in_array($this->getUserPHID(), $reviewers)) {
|
||||
throw new ArcanistUsageException(
|
||||
"You can not be a reviewer for your own revision.");
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ EOTEXT
|
|||
$revision_future = $conduit->callMethod(
|
||||
'differential.find',
|
||||
array(
|
||||
'guids' => array($this->getUserGUID()),
|
||||
'guids' => array($this->getUserPHID()),
|
||||
'query' => 'open',
|
||||
));
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ EOTEXT
|
|||
array(
|
||||
'query' => 'committable',
|
||||
'guids' => array(
|
||||
$this->getUserGUID(),
|
||||
$this->getUserPHID(),
|
||||
),
|
||||
));
|
||||
|
||||
|
|
Loading…
Reference in a new issue