Skip to content

Commit 4c71a22

Browse files
committed
Fixed inactive admin user token
1 parent 349ad46 commit 4c71a22

File tree

3 files changed

+1
-13
lines changed

3 files changed

+1
-13
lines changed

app/code/Magento/Integration/Model/AdminTokenService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function revokeAdminAccessToken($adminId)
110110
{
111111
$tokenCollection = $this->tokenModelCollectionFactory->create()->addFilterByAdminId($adminId);
112112
if ($tokenCollection->getSize() == 0) {
113-
throw new LocalizedException(__('This user has no tokens.'));
113+
return true;
114114
}
115115
try {
116116
foreach ($tokenCollection as $token) {

app/code/Magento/Integration/Test/Unit/Model/AdminTokenServiceTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ public function testRevokeAdminAccessToken()
9999
$this->assertTrue($this->_tokenService->revokeAdminAccessToken($adminId));
100100
}
101101

102-
/**
103-
* @expectedException \Magento\Framework\Exception\LocalizedException
104-
* @expectedExceptionMessage This user has no tokens.
105-
*/
106102
public function testRevokeAdminAccessTokenWithoutAdminId()
107103
{
108104
$this->_tokenModelCollectionMock->expects($this->once())

dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/InvalidateTokenTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ public function testInvalidateTokenNoTokens()
8989
// invalidate token
9090
$this->getRequest()->setParam('user_id', $adminUserId);
9191
$this->dispatch('backend/admin/user/invalidateToken');
92-
$this->assertSessionMessages(
93-
$this->equalTo(['This user has no tokens.']),
94-
MessageInterface::TYPE_ERROR
95-
);
9692
}
9793

9894
public function testInvalidateTokenNoUser()
@@ -110,9 +106,5 @@ public function testInvalidateTokenInvalidUser()
110106
// invalidate token
111107
$this->getRequest()->setParam('user_id', $adminUserId);
112108
$this->dispatch('backend/admin/user/invalidateToken');
113-
$this->assertSessionMessages(
114-
$this->equalTo(['This user has no tokens.']),
115-
MessageInterface::TYPE_ERROR
116-
);
117109
}
118110
}

0 commit comments

Comments
 (0)