Skip to content

Commit 72932f3

Browse files
committed
AC-11496:Fix for import/export tax rates
1 parent b08b7ea commit 72932f3

File tree

4 files changed

+28
-27
lines changed

4 files changed

+28
-27
lines changed

app/code/Magento/TaxImportExport/Controller/Adminhtml/Rate.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\TaxImportExport\Controller\Adminhtml;
710

811
/**
@@ -15,7 +18,7 @@ abstract class Rate extends \Magento\Backend\App\Action
1518
*
1619
* @see _isAllowed()
1720
*/
18-
const ADMIN_RESOURCE = 'Magento_Tax::manage_tax';
21+
public const ADMIN_RESOURCE = 'Magento_Tax::manage_tax';
1922

2023
/**
2124
* @var \Magento\Framework\App\Response\Http\FileFactory
@@ -33,4 +36,19 @@ public function __construct(
3336
$this->fileFactory = $fileFactory;
3437
parent::__construct($context);
3538
}
39+
40+
/**
41+
* Check ACL permission
42+
*
43+
* @return bool
44+
*/
45+
protected function _isAllowed(): bool
46+
{
47+
return match (strtolower($this->getRequest()->getActionName())) {
48+
'importexport','importpost','exportcsv','exportxml', 'exportpost' =>
49+
$this->_authorization->isAllowed('Magento_TaxImportExport::import_export'),
50+
default =>
51+
$this->_authorization->isAllowed(self::ADMIN_RESOURCE),
52+
};
53+
}
3654
}

app/code/Magento/TaxImportExport/Controller/Adminhtml/Rate/ExportPost.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\TaxImportExport\Controller\Adminhtml\Rate;
710

811
use Magento\Framework\App\Filesystem\DirectoryList;
@@ -86,16 +89,4 @@ public function execute()
8689

8790
return $this->fileFactory->create('tax_rates.csv', $fileContent, DirectoryList::VAR_DIR);
8891
}
89-
90-
/**
91-
* @return bool
92-
*/
93-
protected function _isAllowed()
94-
{
95-
return $this->_authorization->isAllowed(
96-
'Magento_Tax::manage_tax'
97-
) || $this->_authorization->isAllowed(
98-
'Magento_TaxImportExport::import_export'
99-
);
100-
}
10192
}

app/code/Magento/TaxImportExport/Controller/Adminhtml/Rate/ImportPost.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\TaxImportExport\Controller\Adminhtml\Rate;
710

811
use Magento\Framework\Controller\ResultFactory;
912

1013
class ImportPost extends \Magento\TaxImportExport\Controller\Adminhtml\Rate
1114
{
1215
/**
13-
* import action from import/export tax
16+
* Import action from import/export tax
1417
*
1518
* @return \Magento\Backend\Model\View\Result\Redirect
1619
*/
@@ -39,16 +42,4 @@ public function execute()
3942
$resultRedirect->setUrl($this->_redirect->getRedirectUrl());
4043
return $resultRedirect;
4144
}
42-
43-
/**
44-
* @return bool
45-
*/
46-
protected function _isAllowed()
47-
{
48-
return $this->_authorization->isAllowed(
49-
'Magento_Tax::manage_tax'
50-
) || $this->_authorization->isAllowed(
51-
'Magento_TaxImportExport::import_export'
52-
);
53-
}
5445
}

app/code/Magento/TaxImportExport/view/adminhtml/layout/tax_rule_edit.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<body>
1010
<referenceBlock name="content">
11-
<block class="Magento\TaxImportExport\Block\Adminhtml\Rate\ImportExport" name="tax-rate-importExport" template="Magento_TaxImportExport::importExport.phtml"/>
11+
<block class="Magento\TaxImportExport\Block\Adminhtml\Rate\ImportExport" name="tax-rate-importExport"
12+
template="Magento_TaxImportExport::importExport.phtml" aclResource="Magento_TaxImportExport::import_export"/>
1213
</referenceBlock>
1314
</body>
1415
</page>

0 commit comments

Comments
 (0)