Skip to content

Commit

Permalink
Merge pull request #37761 from nextcloud/invalidateTokensOnlySeenUsers
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Aug 16, 2024
2 parents 75180a6 + 84ee79f commit b8dbed3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/oauth2/lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function addClient(string $name,
public function deleteClient(int $id): JSONResponse {
$client = $this->clientMapper->getByUid($id);

$this->userManager->callForAllUsers(function (IUser $user) use ($client) {
$this->userManager->callForSeenUsers(function (IUser $user) use ($client) {
$this->tokenProvider->invalidateTokensOfUser($user->getUID(), $client->getName());
});

Expand Down
5 changes: 4 additions & 1 deletion apps/oauth2/tests/Controller/SettingsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ public function testDeleteClient() {
// count other users in the db before adding our own
$count = 0;
$function = function (IUser $user) use (&$count) {
$count++;
if ($user->getLastLogin() > 0) {
$count++;
}
};
$userManager->callForAllUsers($function);
$user1 = $userManager->createUser('test101', 'test101');
$user1->updateLastLoginTimestamp();
$tokenProviderMock = $this->getMockBuilder(IAuthTokenProvider::class)->getMock();

// expect one call per user and ensure the correct client name
Expand Down

0 comments on commit b8dbed3

Please sign in to comment.