Path: blob/master/src/applications/auth/conduit/PhabricatorAuthLogoutConduitAPIMethod.php
12256 views
<?php12final class PhabricatorAuthLogoutConduitAPIMethod3extends PhabricatorAuthConduitAPIMethod {45public function getAPIMethodName() {6return 'auth.logout';7}89public function getMethodSummary() {10return pht('Terminate all login sessions.');11}1213public function getMethodDescription() {14return pht(15'Terminate all web login sessions. If called via OAuth, also terminate '.16'the current OAuth token.'.17"\n\n".18'WARNING: This method does what it claims on the label. If you call '.19'this method via the test console in the web UI, it will log you out!');20}2122protected function defineParamTypes() {23return array();24}2526protected function defineReturnType() {27return 'void';28}2930public function getRequiredScope() {31return self::SCOPE_ALWAYS;32}3334protected function execute(ConduitAPIRequest $request) {35$viewer = $request->getUser();3637// Destroy all web sessions.38$engine = id(new PhabricatorAuthSessionEngine());39$engine->terminateLoginSessions($viewer);4041// If we were called via OAuth, destroy the OAuth token.42$oauth_token = $request->getOAuthToken();43if ($oauth_token) {44$oauth_token->delete();45}4647return null;48}4950}515253