Skip to content

Commit 293685d

Browse files
authored
Removing Proxy features (#1143)
1 parent bf1335c commit 293685d

40 files changed

+77
-1832
lines changed

Block/Adminhtml/Category/Merchandising.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Algolia\AlgoliaSearch\Helper\ConfigHelper;
66
use Algolia\AlgoliaSearch\Helper\Data;
7-
use Algolia\AlgoliaSearch\Helper\ProxyHelper;
87
use Magento\Backend\Block\Template\Context;
98
use Magento\Catalog\Model\Category;
109
use Magento\Framework\Registry;
@@ -23,9 +22,6 @@ class Merchandising extends \Magento\Backend\Block\Template
2322
/** @var Data */
2423
private $coreHelper;
2524

26-
/** @var ProxyHelper */
27-
private $proxyHelper;
28-
2925
/** @var \Magento\Store\Model\StoreManagerInterface */
3026
private $storeManager;
3127

@@ -34,21 +30,18 @@ class Merchandising extends \Magento\Backend\Block\Template
3430
* @param Registry $registry
3531
* @param ConfigHelper $configHelper
3632
* @param Data $coreHelper
37-
* @param ProxyHelper $proxyHelper
3833
* @param array $data
3934
*/
4035
public function __construct(
4136
Context $context,
4237
Registry $registry,
4338
ConfigHelper $configHelper,
4439
Data $coreHelper,
45-
ProxyHelper $proxyHelper,
4640
array $data = []
4741
) {
4842
$this->registry = $registry;
4943
$this->configHelper = $configHelper;
5044
$this->coreHelper = $coreHelper;
51-
$this->proxyHelper = $proxyHelper;
5245
$this->storeManager = $context->getStoreManager();
5346

5447
parent::__construct($context, $data);
@@ -89,20 +82,6 @@ public function getCoreHelper()
8982
return $this->coreHelper;
9083
}
9184

92-
/** @return bool */
93-
public function isQueryRulesEnabled()
94-
{
95-
$info = $this->proxyHelper->getInfo(ProxyHelper::INFO_TYPE_QUERY_RULES);
96-
97-
// In case the call to API proxy fails,
98-
// be "nice" and return true
99-
if ($info && array_key_exists('query_rules', $info)) {
100-
return $info['query_rules'];
101-
}
102-
103-
return true;
104-
}
105-
10685
/**
10786
* @throws \Magento\Framework\Exception\NoSuchEntityException
10887
*

Block/Adminhtml/LandingPage/SearchConfiguration.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Algolia\AlgoliaSearch\Helper\ConfigHelper;
66
use Algolia\AlgoliaSearch\Helper\Data;
7-
use Algolia\AlgoliaSearch\Helper\ProxyHelper;
87
use Algolia\AlgoliaSearch\Model\LandingPage;
98
use Magento\Backend\Block\Template\Context;
109
use Magento\Framework\Registry;
@@ -23,9 +22,6 @@ class SearchConfiguration extends \Magento\Backend\Block\Template
2322
/** @var Data */
2423
private $coreHelper;
2524

26-
/** @var ProxyHelper */
27-
protected $proxyHelper;
28-
2925
/** @var int */
3026
protected $planLevel;
3127

@@ -34,21 +30,18 @@ class SearchConfiguration extends \Magento\Backend\Block\Template
3430
* @param Registry $registry
3531
* @param ConfigHelper $configHelper
3632
* @param Data $coreHelper
37-
* @param ProxyHelper $proxyHelper
3833
* @param array $data
3934
*/
4035
public function __construct(
4136
Context $context,
4237
Registry $registry,
4338
ConfigHelper $configHelper,
4439
Data $coreHelper,
45-
ProxyHelper $proxyHelper,
4640
array $data = []
4741
) {
4842
$this->registry = $registry;
4943
$this->configHelper = $configHelper;
5044
$this->coreHelper = $coreHelper;
51-
$this->proxyHelper = $proxyHelper;
5245

5346
parent::__construct($context, $data);
5447
}
@@ -70,20 +63,4 @@ public function getCoreHelper()
7063
{
7164
return $this->coreHelper;
7265
}
73-
74-
/** @return int */
75-
public function getPlanLevel()
76-
{
77-
if ($this->planLevel == null) {
78-
$planLevel = 1;
79-
$planLevelInfo = $this->proxyHelper->getInfo(ProxyHelper::INFO_TYPE_PLAN_LEVEL);
80-
81-
if (isset($planLevelInfo['plan_level'])) {
82-
$planLevel = (int) $planLevelInfo['plan_level'];
83-
}
84-
$this->planLevel = $planLevel;
85-
}
86-
87-
return $this->planLevel;
88-
}
8966
}

Block/Adminhtml/Query/Merchandising.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Algolia\AlgoliaSearch\Helper\ConfigHelper;
66
use Algolia\AlgoliaSearch\Helper\Data;
7-
use Algolia\AlgoliaSearch\Helper\ProxyHelper;
87
use Algolia\AlgoliaSearch\Model\Query;
98
use Magento\Backend\Block\Template\Context;
109
use Magento\Framework\Registry;
@@ -23,9 +22,6 @@ class Merchandising extends \Magento\Backend\Block\Template
2322
/** @var Data */
2423
private $coreHelper;
2524

26-
/** @var ProxyHelper */
27-
private $proxyHelper;
28-
2925
/** @var \Magento\Store\Model\StoreManagerInterface */
3026
private $storeManager;
3127

@@ -34,21 +30,18 @@ class Merchandising extends \Magento\Backend\Block\Template
3430
* @param Registry $registry
3531
* @param ConfigHelper $configHelper
3632
* @param Data $coreHelper
37-
* @param ProxyHelper $proxyHelper
3833
* @param array $data
3934
*/
4035
public function __construct(
4136
Context $context,
4237
Registry $registry,
4338
ConfigHelper $configHelper,
4439
Data $coreHelper,
45-
ProxyHelper $proxyHelper,
4640
array $data = []
4741
) {
4842
$this->registry = $registry;
4943
$this->configHelper = $configHelper;
5044
$this->coreHelper = $coreHelper;
51-
$this->proxyHelper = $proxyHelper;
5245
$this->storeManager = $context->getStoreManager();
5346

5447
parent::__construct($context, $data);
@@ -72,20 +65,6 @@ public function getCoreHelper()
7265
return $this->coreHelper;
7366
}
7467

75-
/** @return bool */
76-
public function isQueryRulesEnabled()
77-
{
78-
$info = $this->proxyHelper->getInfo(ProxyHelper::INFO_TYPE_QUERY_RULES);
79-
80-
// In case the call to API proxy fails,
81-
// be "nice" and return true
82-
if ($info && array_key_exists('query_rules', $info)) {
83-
return $info['query_rules'];
84-
}
85-
86-
return true;
87-
}
88-
8968
/**
9069
* @throws \Magento\Framework\Exception\NoSuchEntityException
9170
*

Block/System/Form/Field/Logo.php

Lines changed: 0 additions & 46 deletions
This file was deleted.

Controller/Adminhtml/Landingpage/AbstractAction.php

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Algolia\AlgoliaSearch\Controller\Adminhtml\Landingpage;
44

55
use Algolia\AlgoliaSearch\Helper\MerchandisingHelper;
6-
use Algolia\AlgoliaSearch\Helper\ProxyHelper;
76
use Algolia\AlgoliaSearch\Model\LandingPageFactory;
87
use Magento\Backend\App\Action\Context;
98
use Magento\Framework\Registry;
@@ -20,9 +19,6 @@ abstract class AbstractAction extends \Magento\Backend\App\Action
2019
/** @var MerchandisingHelper */
2120
protected $merchandisingHelper;
2221

23-
/** @var ProxyHelper */
24-
protected $proxyHelper;
25-
2622
/** @var StoreManagerInterface */
2723
protected $storeManager;
2824

@@ -31,23 +27,20 @@ abstract class AbstractAction extends \Magento\Backend\App\Action
3127
* @param Registry $coreRegistry
3228
* @param LandingPageFactory $landingPageFactory
3329
* @param MerchandisingHelper $merchandisingHelper
34-
* @param ProxyHelper $proxyHelper
3530
* @param StoreManagerInterface $storeManager
3631
*/
3732
public function __construct(
3833
Context $context,
3934
Registry $coreRegistry,
4035
LandingPageFactory $landingPageFactory,
4136
MerchandisingHelper $merchandisingHelper,
42-
ProxyHelper $proxyHelper,
4337
StoreManagerInterface $storeManager
4438
) {
4539
parent::__construct($context);
4640

4741
$this->coreRegistry = $coreRegistry;
4842
$this->landingPageFactory = $landingPageFactory;
4943
$this->merchandisingHelper = $merchandisingHelper;
50-
$this->proxyHelper = $proxyHelper;
5144
$this->storeManager = $storeManager;
5245
}
5346

@@ -57,35 +50,6 @@ protected function _isAllowed()
5750
return $this->_authorization->isAllowed('Algolia_AlgoliaSearch::manage');
5851
}
5952

60-
/**
61-
* {@inheritdoc}
62-
*/
63-
public function dispatch(\Magento\Framework\App\RequestInterface $request)
64-
{
65-
$planLevelInfo = $this->proxyHelper->getClientConfigurationData();
66-
$planLevel = isset($planLevelInfo['plan_level']) ? (int) $planLevelInfo['plan_level'] : 1;
67-
68-
if ($planLevel <= 1) {
69-
$this->_response->setStatusHeader(403, '1.1', 'Forbidden');
70-
if (!$this->_auth->isLoggedIn()) {
71-
return $this->_redirect('*/auth/login');
72-
}
73-
$this->_view->loadLayout(
74-
['default', 'algolia_algoliasearch_handle_access_denied'],
75-
true,
76-
true,
77-
false
78-
);
79-
$this->_view->getLayout();
80-
$this->_view->renderLayout();
81-
$this->_request->setDispatched(true);
82-
83-
return $this->_response;
84-
}
85-
86-
return parent::dispatch($request);
87-
}
88-
8953
/** @return \Algolia\AlgoliaSearch\Model\LandingPage */
9054
protected function initLandingPage()
9155
{

Controller/Adminhtml/Landingpage/Save.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Algolia\AlgoliaSearch\Controller\Adminhtml\Landingpage;
44

55
use Algolia\AlgoliaSearch\Helper\MerchandisingHelper;
6-
use Algolia\AlgoliaSearch\Helper\ProxyHelper;
76
use Algolia\AlgoliaSearch\Model\LandingPageFactory;
87
use Magento\Framework\App\Request\DataPersistorInterface;
98
use Magento\Framework\Controller\ResultFactory;
@@ -24,7 +23,6 @@ class Save extends AbstractAction
2423
* @param \Magento\Framework\Registry $coreRegistry
2524
* @param LandingPageFactory $landingPageFactory
2625
* @param MerchandisingHelper $merchandisingHelper
27-
* @param ProxyHelper $proxyHelper
2826
* @param StoreManagerInterface $storeManager
2927
* @param DataPersistorInterface $dataPersistor
3028
*
@@ -35,7 +33,6 @@ public function __construct(
3533
\Magento\Framework\Registry $coreRegistry,
3634
LandingPageFactory $landingPageFactory,
3735
MerchandisingHelper $merchandisingHelper,
38-
ProxyHelper $proxyHelper,
3936
StoreManagerInterface $storeManager,
4037
DataPersistorInterface $dataPersistor
4138
) {
@@ -46,7 +43,6 @@ public function __construct(
4643
$coreRegistry,
4744
$landingPageFactory,
4845
$merchandisingHelper,
49-
$proxyHelper,
5046
$storeManager
5147
);
5248
}

0 commit comments

Comments
 (0)