Skip to content

Commit 655163e

Browse files
Merge branch 'AC-11610' into cia-2.4.8-beta1-develop-bugfix-09052024
2 parents d67e684 + 9a105a3 commit 655163e

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

app/code/Magento/AdvancedSearch/Controller/Adminhtml/Search/System/Config/TestConnection.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,27 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
declare(strict_types=1);
8+
79
namespace Magento\AdvancedSearch\Controller\Adminhtml\Search\System\Config;
810

911
use Magento\Backend\App\Action;
1012
use Magento\Backend\App\Action\Context;
1113
use Magento\AdvancedSearch\Model\Client\ClientResolver;
14+
use Magento\Framework\App\Action\HttpPostActionInterface;
15+
use Magento\Framework\Controller\Result\Json;
1216
use Magento\Framework\Controller\Result\JsonFactory;
17+
use Magento\Framework\Exception\LocalizedException;
1318
use Magento\Framework\Filter\StripTags;
1419

15-
class TestConnection extends Action
20+
class TestConnection extends Action implements HttpPostActionInterface
1621
{
1722
/**
1823
* Authorization level of a basic admin session.
1924
*
2025
* @see _isAllowed()
2126
*/
22-
const ADMIN_RESOURCE = 'Magento_CatalogSearch::config_catalog_search';
27+
public const ADMIN_RESOURCE = 'Magento_Catalog::config_catalog';
2328

2429
/**
2530
* @var ClientResolver
@@ -57,7 +62,7 @@ public function __construct(
5762
/**
5863
* Check for connection to server
5964
*
60-
* @return \Magento\Framework\Controller\Result\Json
65+
* @return Json
6166
*/
6267
public function execute()
6368
{
@@ -69,22 +74,22 @@ public function execute()
6974

7075
try {
7176
if (empty($options['engine'])) {
72-
throw new \Magento\Framework\Exception\LocalizedException(
77+
throw new LocalizedException(
7378
__('Missing search engine parameter.')
7479
);
7580
}
7681
$response = $this->clientResolver->create($options['engine'], $options)->testConnection();
7782
if ($response) {
7883
$result['success'] = true;
7984
}
80-
} catch (\Magento\Framework\Exception\LocalizedException $e) {
85+
} catch (LocalizedException $e) {
8186
$result['errorMessage'] = $e->getMessage();
8287
} catch (\Exception $e) {
8388
$message = __($e->getMessage());
8489
$result['errorMessage'] = $this->tagFilter->filter($message);
8590
}
8691

87-
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
92+
/** @var Json $resultJson */
8893
$resultJson = $this->resultJsonFactory->create();
8994
return $resultJson->setData($result);
9095
}

app/code/Magento/CatalogSearch/etc/acl.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
<resource id="Magento_Backend::stores_settings">
1414
<resource id="Magento_Config::config">
1515
<resource id="Magento_Catalog::config_catalog" title="Catalog Section" translate="title">
16-
<resource id="Magento_CatalogSearch::config_catalog_search" title="Catalog Search" translate="title" sortOrder="10" />
16+
<resource id="Magento_CatalogSearch::config_catalog_search" title="Catalog Search" translate="title" sortOrder="10" disabled="true" />
1717
</resource>
1818
</resource>
1919
</resource>
2020
</resource>
2121
</resource>
2222
</resources>
2323
</acl>
24-
</config>
24+
</config>

0 commit comments

Comments
 (0)