converter = $converter; $this->fileFactory = $fileFactory; $this->filter = $filter ?: ObjectManager::getInstance()->get(Filter::class); $this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class); } /** * Export data provider to CSV * * @throws \Magento\Framework\Exception\LocalizedException * @return \Magento\Framework\App\ResponseInterface */ public function execute() { return $this->fileFactory->create('export.csv', $this->converter->getCsvFile(), 'var'); } /** * Checking if the user has access to requested component. * * @inheritDoc */ protected function _isAllowed() { if ($this->_request->getParam('namespace')) { try { $component = $this->filter->getComponent(); $dataProviderConfig = $component->getContext() ->getDataProvider() ->getConfigData(); if (isset($dataProviderConfig['aclResource'])) { return $this->_authorization->isAllowed( $dataProviderConfig['aclResource'] ); } } catch (\Throwable $exception) { $this->logger->critical($exception); return false; } } return true; } }