1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Clean up redirect URIs for "Temporary Tokens" and "API Tokens" settings panels

Summary: Fixes T11223. I missed a few of these; most of them kept working anyway because we have redirects in place, but make them a bit more modern/not-hard-coded.

Test Plan:
  - Generated and revoked API tokens for myself.
  - Generated and revoked API tokens for bots.
  - Revoked temporary tokens for myself.
  - Clicked the link to the API tokens panel from the Conduit console.
  - Clicked all the cancel buttons in all the dialogs, too.

In all cases, everything now points at the correct URIs. Previously, some things pointed at the wrong URIs (mostly dealing with stuff for bots).

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11223

Differential Revision: https://secure.phabricator.com/D16185
This commit is contained in:
epriestley 2016-06-28 14:22:31 -07:00
parent 84ce863116
commit ec8581ab62
4 changed files with 23 additions and 10 deletions

View file

@ -24,7 +24,10 @@ final class PhabricatorAuthRevokeTokenController
}
}
$panel_uri = '/settings/panel/tokens/';
$panel_uri = id(new PhabricatorTokensSettingsPanel())
->setViewer($viewer)
->setUser($viewer)
->getPanelURI();
if (!$tokens) {
return $this->newDialog()

View file

@ -25,6 +25,8 @@ abstract class PhabricatorConduitController extends PhabricatorController {
}
protected function renderExampleBox(ConduitAPIMethod $method, $params) {
$viewer = $this->getViewer();
$arc_example = id(new PHUIPropertyListView())
->addRawContent($this->renderExample($method, 'arc', $params));
@ -34,10 +36,15 @@ abstract class PhabricatorConduitController extends PhabricatorController {
$php_example = id(new PHUIPropertyListView())
->addRawContent($this->renderExample($method, 'php', $params));
$panel_uri = id(new PhabricatorConduitTokensSettingsPanel())
->setViewer($viewer)
->setUser($viewer)
->getPanelURI();
$panel_link = phutil_tag(
'a',
array(
'href' => '/settings/panel/apitokens/',
'href' => $panel_uri,
),
pht('Conduit API Tokens'));

View file

@ -49,11 +49,10 @@ final class PhabricatorConduitTokenEditController
$submit_button = pht('Generate Token');
}
if ($viewer->getPHID() == $object->getPHID()) {
$panel_uri = '/settings/panel/apitokens/';
} else {
$panel_uri = '/settings/'.$object->getID().'/panel/apitokens/';
}
$panel_uri = id(new PhabricatorConduitTokensSettingsPanel())
->setViewer($viewer)
->setUser($object)
->getPanelURI();
id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
$viewer,

View file

@ -31,7 +31,6 @@ final class PhabricatorConduitTokenTerminateController
'Really terminate this token? Any system using this token '.
'will no longer be able to make API requests.');
$submit_button = pht('Terminate Token');
$panel_uri = '/settings/panel/apitokens/';
} else {
$tokens = id(new PhabricatorConduitTokenQuery())
->setViewer($viewer)
@ -51,7 +50,6 @@ final class PhabricatorConduitTokenTerminateController
$submit_button = pht('Terminate Tokens');
}
$panel_uri = '/settings/panel/apitokens/';
if ($object_phid != $viewer->getPHID()) {
$object = id(new PhabricatorObjectQuery())
->setViewer($viewer)
@ -60,9 +58,15 @@ final class PhabricatorConduitTokenTerminateController
if (!$object) {
return new Aphront404Response();
}
$panel_uri = '/settings/'.$object->getID().'/panel/apitokens/';
} else {
$object = $viewer;
}
$panel_uri = id(new PhabricatorConduitTokensSettingsPanel())
->setViewer($viewer)
->setUser($object)
->getPanelURI();
id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
$viewer,
$request,