22 class Massaction extends \Magento\Backend\Block\Widget\Grid\Massaction\AbstractMassaction
27 private $authorization;
35 private $restrictions = [
36 'enable' =>
'Magento_Backend::toggling_cache_type',
37 'disable' =>
'Magento_Backend::toggling_cache_type',
38 'refresh' =>
'Magento_Backend::refresh_cache_type',
55 $this->authorization = $authorization ?: ObjectManager::getInstance()->get(AuthorizationInterface::class);
57 parent::__construct($context, $jsonEncoder,
$data);
71 if (!$this->isRestricted($itemId)) {
72 parent::addItem($itemId,
$item);
85 private function isRestricted(
string $itemId): bool
87 if (!key_exists($itemId, $this->restrictions)) {
91 return !$this->authorization->isAllowed($this->restrictions[$itemId]);