diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2133,6 +2133,7 @@ 'PhabricatorAuthTemporaryToken' => 'applications/auth/storage/PhabricatorAuthTemporaryToken.php', 'PhabricatorAuthTemporaryTokenGarbageCollector' => 'applications/auth/garbagecollector/PhabricatorAuthTemporaryTokenGarbageCollector.php', 'PhabricatorAuthTemporaryTokenQuery' => 'applications/auth/query/PhabricatorAuthTemporaryTokenQuery.php', + 'PhabricatorAuthTemporaryTokenRevoker' => 'applications/auth/revoker/PhabricatorAuthTemporaryTokenRevoker.php', 'PhabricatorAuthTemporaryTokenType' => 'applications/auth/tokentype/PhabricatorAuthTemporaryTokenType.php', 'PhabricatorAuthTemporaryTokenTypeModule' => 'applications/auth/tokentype/PhabricatorAuthTemporaryTokenTypeModule.php', 'PhabricatorAuthTerminateSessionController' => 'applications/auth/controller/PhabricatorAuthTerminateSessionController.php', @@ -7422,6 +7423,7 @@ ), 'PhabricatorAuthTemporaryTokenGarbageCollector' => 'PhabricatorGarbageCollector', 'PhabricatorAuthTemporaryTokenQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', + 'PhabricatorAuthTemporaryTokenRevoker' => 'PhabricatorAuthRevoker', 'PhabricatorAuthTemporaryTokenType' => 'Phobject', 'PhabricatorAuthTemporaryTokenTypeModule' => 'PhabricatorConfigModule', 'PhabricatorAuthTerminateSessionController' => 'PhabricatorAuthController', diff --git a/src/applications/auth/revoker/PhabricatorAuthTemporaryTokenRevoker.php b/src/applications/auth/revoker/PhabricatorAuthTemporaryTokenRevoker.php new file mode 100644 --- /dev/null +++ b/src/applications/auth/revoker/PhabricatorAuthTemporaryTokenRevoker.php @@ -0,0 +1,33 @@ +establishConnection('w'); + + queryfx( + $conn, + 'DELETE FROM %T', + $table->getTableName()); + + return $conn->getAffectedRows(); + } + + public function revokeCredentialsFrom($object) { + $table = new PhabricatorAuthTemporaryToken(); + $conn = $table->establishConnection('w'); + + queryfx( + $conn, + 'DELETE FROM %T WHERE tokenResource = %s', + $table->getTableName(), + $object->getPHID()); + + return $conn->getAffectedRows(); + } + +} diff --git a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php --- a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php +++ b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php @@ -1646,6 +1646,11 @@ '%s objects.', ), + 'Destroyed %s credential(s) of type "%s".' => array( + 'Destroyed one credential of type "%2$s".', + 'Destroyed %s credentials of type "%s".', + ), + ); }