Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Product.php
Go to the documentation of this file.
1 <?php
7 
11 use Magento\Review\Model\ReviewFactory;
12 use Magento\Review\Model\RatingFactory;
13 
17 abstract class Product extends Action
18 {
24  protected $_publicActions = ['edit'];
25 
31  protected $coreRegistry = null;
32 
38  protected $reviewFactory;
39 
45  protected $ratingFactory;
46 
53  public function __construct(
54  Context $context,
56  ReviewFactory $reviewFactory,
57  RatingFactory $ratingFactory
58  ) {
59  $this->coreRegistry = $coreRegistry;
60  $this->reviewFactory = $reviewFactory;
61  $this->ratingFactory = $ratingFactory;
62  parent::__construct($context);
63  }
64 
68  protected function _isAllowed()
69  {
70  switch ($this->getRequest()->getActionName()) {
71  case 'pending':
72  return $this->_authorization->isAllowed('Magento_Review::pending');
73  break;
74  default:
75  return $this->_authorization->isAllowed('Magento_Review::reviews_all');
76  break;
77  }
78  }
79 }
__construct(Context $context, Registry $coreRegistry, ReviewFactory $reviewFactory, RatingFactory $ratingFactory)
Definition: Product.php:53