33 * Copyright © Magento, Inc. All rights reserved.
44 * See COPYING.txt for license details.
55 */
6+ declare (strict_types=1 );
67
78/**
89 * Review reports admin controller
1112 */
1213namespace Magento \Reports \Controller \Adminhtml \Report ;
1314
15+ use Magento \Backend \App \Action ;
16+ use Magento \Backend \App \Action \Context ;
17+ use Magento \Framework \App \Response \Http \FileFactory ;
18+
1419/**
20+ * phpcs:disable Magento2.Classes.AbstractApi
1521 * @api
1622 * @since 100.0.2
1723 */
18- abstract class Review extends \ Magento \ Backend \ App \ Action
24+ abstract class Review extends Action
1925{
2026 /**
21- * @var \Magento\Framework\App\Response\Http\ FileFactory
27+ * @var FileFactory
2228 */
2329 protected $ _fileFactory ;
2430
2531 /**
26- * @param \Magento\Backend\App\Action\ Context $context
27- * @param \Magento\Framework\App\Response\Http\ FileFactory $fileFactory
32+ * @param Context $context
33+ * @param FileFactory $fileFactory
2834 */
2935 public function __construct (
30- \ Magento \ Backend \ App \ Action \ Context $ context ,
31- \ Magento \ Framework \ App \ Response \ Http \ FileFactory $ fileFactory
36+ Context $ context ,
37+ FileFactory $ fileFactory
3238 ) {
3339 $ this ->_fileFactory = $ fileFactory ;
3440 parent ::__construct ($ context );
@@ -54,16 +60,20 @@ public function _initAction()
5460 */
5561 protected function _isAllowed ()
5662 {
57- switch ($ this ->getRequest ()->getActionName ()) {
58- case 'customer ' :
59- return $ this ->_authorization ->isAllowed ('Magento_Reports::review_customer ' );
60- break ;
61- case 'product ' :
62- return $ this ->_authorization ->isAllowed ('Magento_Reports::review_product ' );
63- break ;
64- default :
65- return $ this ->_authorization ->isAllowed ('Magento_Reports::review ' );
66- break ;
67- }
63+ return match ($ this ->getRequest ()->getActionName ()) {
64+ 'exportCustomerCsv ' ,
65+ 'exportCustomerExcel ' ,
66+ 'customer ' =>
67+ $ this ->_authorization ->isAllowed ('Magento_Reports::review_customer ' ),
68+ 'exportProductCsv ' ,
69+ 'exportProductExcel ' ,
70+ 'exportProductDetailCsv ' ,
71+ 'exportProductDetailExcel ' ,
72+ 'productDetail ' ,
73+ 'product ' =>
74+ $ this ->_authorization ->isAllowed ('Magento_Reports::review_product ' ),
75+ default =>
76+ $ this ->_authorization ->isAllowed ('Magento_Reports::review ' ),
77+ };
6878 }
6979}
0 commit comments