Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed inactive admin user token #16918

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/code/Magento/Integration/Model/AdminTokenService.php
Expand Up @@ -107,7 +107,7 @@ public function revokeAdminAccessToken($adminId)
{
$tokenCollection = $this->tokenModelCollectionFactory->create()->addFilterByAdminId($adminId);
if ($tokenCollection->getSize() == 0) {
throw new LocalizedException(__('This user has no tokens.'));
return true;
}
try {
foreach ($tokenCollection as $token) {
Expand Down
Expand Up @@ -100,10 +100,6 @@ public function testRevokeAdminAccessToken()
$this->assertTrue($this->_tokenService->revokeAdminAccessToken($adminId));
}

/**
* @expectedException \Magento\Framework\Exception\LocalizedException
* @expectedExceptionMessage This user has no tokens.
*/
public function testRevokeAdminAccessTokenWithoutAdminId()
{
$this->_tokenModelCollectionMock->expects($this->once())
Expand Down
Expand Up @@ -91,10 +91,6 @@ public function testInvalidateToken_NoTokens()
// invalidate token
$this->getRequest()->setParam('user_id', $adminUserId);
$this->dispatch('backend/admin/user/invalidateToken');
$this->assertSessionMessages(
$this->equalTo(['This user has no tokens.']),
MessageInterface::TYPE_ERROR
);
}

public function testInvalidateToken_NoUser()
Expand All @@ -112,9 +108,5 @@ public function testInvalidateToken_InvalidUser()
// invalidate token
$this->getRequest()->setParam('user_id', $adminUserId);
$this->dispatch('backend/admin/user/invalidateToken');
$this->assertSessionMessages(
$this->equalTo(['This user has no tokens.']),
MessageInterface::TYPE_ERROR
);
}
}