Skip to content

Commit

Permalink
Fixed inactive admin user token
Browse files Browse the repository at this point in the history
  • Loading branch information
mage2pratik committed Jan 29, 2019
1 parent 349ad46 commit 4c71a22
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 13 deletions.
2 changes: 1 addition & 1 deletion app/code/Magento/Integration/Model/AdminTokenService.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,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
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,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
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ public function testInvalidateTokenNoTokens()
// 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 testInvalidateTokenNoUser()
Expand All @@ -110,9 +106,5 @@ public function testInvalidateTokenInvalidUser()
// 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
);
}
}

0 comments on commit 4c71a22

Please sign in to comment.