Differential D15478 Diff 37311 src/applications/auth/controller/PhabricatorAuthRevokeTokenController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/controller/PhabricatorAuthRevokeTokenController.php
| <?php | <?php | ||||
| final class PhabricatorAuthRevokeTokenController | final class PhabricatorAuthRevokeTokenController | ||||
| extends PhabricatorAuthController { | extends PhabricatorAuthController { | ||||
| public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $id = $request->getURIData('id'); | $id = $request->getURIData('id'); | ||||
| $is_all = ($id === 'all'); | $is_all = ($id === 'all'); | ||||
| $query = id(new PhabricatorAuthTemporaryTokenQuery()) | $query = id(new PhabricatorAuthTemporaryTokenQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withObjectPHIDs(array($viewer->getPHID())); | ->withTokenResources(array($viewer->getPHID())); | ||||
| if (!$is_all) { | if (!$is_all) { | ||||
| $query->withIDs(array($id)); | $query->withIDs(array($id)); | ||||
| } | } | ||||
| $tokens = $query->execute(); | $tokens = $query->execute(); | ||||
| foreach ($tokens as $key => $token) { | foreach ($tokens as $key => $token) { | ||||
| if (!$token->isRevocable()) { | if (!$token->isRevocable()) { | ||||
| // Don't revoke unrevocable tokens. | // Don't revoke unrevocable tokens. | ||||
| ▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines | |||||