From 82aa0c1edecdc355286cd8f6b82be19fa438ead7 Mon Sep 17 00:00:00 2001 From: mage2pratik Date: Thu, 19 Jul 2018 00:02:36 +0530 Subject: [PATCH 1/3] Fixed inactive admin user token error --- app/code/Magento/Integration/Model/AdminTokenService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Integration/Model/AdminTokenService.php b/app/code/Magento/Integration/Model/AdminTokenService.php index 080181b5d8d61..b997b5582dcd7 100644 --- a/app/code/Magento/Integration/Model/AdminTokenService.php +++ b/app/code/Magento/Integration/Model/AdminTokenService.php @@ -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) { From 76b21a68f4f66a993571d3a196df83966d966ced Mon Sep 17 00:00:00 2001 From: mage2pratik Date: Sat, 11 Aug 2018 00:11:13 +0530 Subject: [PATCH 2/3] Fixed inactive admin user token error --- .../Integration/Test/Unit/Model/AdminTokenServiceTest.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/code/Magento/Integration/Test/Unit/Model/AdminTokenServiceTest.php b/app/code/Magento/Integration/Test/Unit/Model/AdminTokenServiceTest.php index 3ce760a47f61f..1dbb47c19917a 100644 --- a/app/code/Magento/Integration/Test/Unit/Model/AdminTokenServiceTest.php +++ b/app/code/Magento/Integration/Test/Unit/Model/AdminTokenServiceTest.php @@ -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()) From 73d9526e36fbb4830b6f8fe2fa742182fc491967 Mon Sep 17 00:00:00 2001 From: mage2pratik Date: Mon, 20 Aug 2018 01:19:24 +0530 Subject: [PATCH 3/3] Fixed inactive admin user token error --- .../Controller/Adminhtml/User/InvalidateTokenTest.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/InvalidateTokenTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/InvalidateTokenTest.php index fefb0dad0f319..7312dc63ea37e 100644 --- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/InvalidateTokenTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/User/InvalidateTokenTest.php @@ -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() @@ -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 - ); } }