From 474e416b9f40c12a907bdc4d0b2b71075b019d5a Mon Sep 17 00:00:00 2001 From: mageprince Date: Thu, 23 Apr 2020 10:38:32 +0530 Subject: [PATCH] Solve admin user roles resources issue --- Controller/Adminhtml/Faq/Delete.php | 8 ++++++++ Controller/Adminhtml/Faq/Edit.php | 8 ++++++++ Controller/Adminhtml/Faq/Index.php | 8 ++++++++ Controller/Adminhtml/Faq/InlineEdit.php | 8 ++++++++ Controller/Adminhtml/Faq/MassDelete.php | 20 +++++++++++++++++--- Controller/Adminhtml/Faq/NewAction.php | 8 ++++++++ Controller/Adminhtml/Faq/Save.php | 8 ++++++++ Controller/Adminhtml/FaqGroup/Delete.php | 7 +++++++ Controller/Adminhtml/FaqGroup/Edit.php | 8 ++++++++ Controller/Adminhtml/FaqGroup/Index.php | 8 ++++++++ Controller/Adminhtml/FaqGroup/InlineEdit.php | 8 ++++++++ Controller/Adminhtml/FaqGroup/MassDelete.php | 16 +++++++++++++++- Controller/Adminhtml/FaqGroup/NewAction.php | 8 ++++++++ Controller/Adminhtml/FaqGroup/Save.php | 8 ++++++++ composer.json | 2 +- etc/module.xml | 2 +- 16 files changed, 129 insertions(+), 6 deletions(-) diff --git a/Controller/Adminhtml/Faq/Delete.php b/Controller/Adminhtml/Faq/Delete.php index 7e2c205..5324286 100755 --- a/Controller/Adminhtml/Faq/Delete.php +++ b/Controller/Adminhtml/Faq/Delete.php @@ -14,6 +14,14 @@ class Delete extends \Mageprince\Faq\Controller\Adminhtml\Faq { + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::Faq'); + } + /** * Delete action * diff --git a/Controller/Adminhtml/Faq/Edit.php b/Controller/Adminhtml/Faq/Edit.php index c612c92..3c388d1 100755 --- a/Controller/Adminhtml/Faq/Edit.php +++ b/Controller/Adminhtml/Faq/Edit.php @@ -45,6 +45,14 @@ public function __construct( parent::__construct($context, $coreRegistry); } + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::Faq'); + } + /** * Edit action * diff --git a/Controller/Adminhtml/Faq/Index.php b/Controller/Adminhtml/Faq/Index.php index c8a252c..d60309b 100755 --- a/Controller/Adminhtml/Faq/Index.php +++ b/Controller/Adminhtml/Faq/Index.php @@ -31,6 +31,14 @@ public function __construct( parent::__construct($context); } + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::Faq'); + } + /** * Index action * diff --git a/Controller/Adminhtml/Faq/InlineEdit.php b/Controller/Adminhtml/Faq/InlineEdit.php index 0079b79..37e153b 100755 --- a/Controller/Adminhtml/Faq/InlineEdit.php +++ b/Controller/Adminhtml/Faq/InlineEdit.php @@ -36,6 +36,14 @@ public function __construct( $this->jsonFactory = $jsonFactory; } + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::Faq'); + } + /** * Inline edit action * diff --git a/Controller/Adminhtml/Faq/MassDelete.php b/Controller/Adminhtml/Faq/MassDelete.php index 46e48ac..ff54c29 100755 --- a/Controller/Adminhtml/Faq/MassDelete.php +++ b/Controller/Adminhtml/Faq/MassDelete.php @@ -18,13 +18,19 @@ class MassDelete extends \Magento\Backend\App\Action /** * @var \Magento\Ui\Component\MassAction\Filter $filter */ - private $filter; + protected $filter; /** * @var \Mageprince\Faq\Model\ResourceModel\Faq\CollectionFactory */ - private $collectionFactory; - + protected $collectionFactory; + + /** + * MassDelete constructor. + * @param \Magento\Ui\Component\MassAction\Filter $filter + * @param \Mageprince\Faq\Model\ResourceModel\Faq\CollectionFactory $collectionFactory + * @param \Magento\Backend\App\Action\Context $context + */ public function __construct( \Magento\Ui\Component\MassAction\Filter $filter, \Mageprince\Faq\Model\ResourceModel\Faq\CollectionFactory $collectionFactory, @@ -35,6 +41,14 @@ public function __construct( parent::__construct($context); } + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::Faq'); + } + public function execute() { try { diff --git a/Controller/Adminhtml/Faq/NewAction.php b/Controller/Adminhtml/Faq/NewAction.php index c7da320..e8e5632 100755 --- a/Controller/Adminhtml/Faq/NewAction.php +++ b/Controller/Adminhtml/Faq/NewAction.php @@ -31,6 +31,14 @@ public function __construct( parent::__construct($context, $coreRegistry); } + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::Faq'); + } + /** * New action * diff --git a/Controller/Adminhtml/Faq/Save.php b/Controller/Adminhtml/Faq/Save.php index 8d09c52..ba99784 100755 --- a/Controller/Adminhtml/Faq/Save.php +++ b/Controller/Adminhtml/Faq/Save.php @@ -35,6 +35,14 @@ public function __construct( parent::__construct($context); } + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::Faq'); + } + /** * Save action * diff --git a/Controller/Adminhtml/FaqGroup/Delete.php b/Controller/Adminhtml/FaqGroup/Delete.php index 02959a7..7d8cc9b 100755 --- a/Controller/Adminhtml/FaqGroup/Delete.php +++ b/Controller/Adminhtml/FaqGroup/Delete.php @@ -14,6 +14,13 @@ class Delete extends \Mageprince\Faq\Controller\Adminhtml\FaqGroup { + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup'); + } /** * Delete action diff --git a/Controller/Adminhtml/FaqGroup/Edit.php b/Controller/Adminhtml/FaqGroup/Edit.php index 73e2083..b8635df 100755 --- a/Controller/Adminhtml/FaqGroup/Edit.php +++ b/Controller/Adminhtml/FaqGroup/Edit.php @@ -42,6 +42,14 @@ public function __construct( parent::__construct($context, $coreRegistry); } + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup'); + } + /** * Edit action * diff --git a/Controller/Adminhtml/FaqGroup/Index.php b/Controller/Adminhtml/FaqGroup/Index.php index f0d0847..3b0828b 100755 --- a/Controller/Adminhtml/FaqGroup/Index.php +++ b/Controller/Adminhtml/FaqGroup/Index.php @@ -34,6 +34,14 @@ public function __construct( parent::__construct($context); } + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup'); + } + /** * Index action * diff --git a/Controller/Adminhtml/FaqGroup/InlineEdit.php b/Controller/Adminhtml/FaqGroup/InlineEdit.php index a3a8b19..7593e33 100755 --- a/Controller/Adminhtml/FaqGroup/InlineEdit.php +++ b/Controller/Adminhtml/FaqGroup/InlineEdit.php @@ -39,6 +39,14 @@ public function __construct( $this->jsonFactory = $jsonFactory; } + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup'); + } + /** * Inline edit action * diff --git a/Controller/Adminhtml/FaqGroup/MassDelete.php b/Controller/Adminhtml/FaqGroup/MassDelete.php index 1a08041..3d3aa47 100755 --- a/Controller/Adminhtml/FaqGroup/MassDelete.php +++ b/Controller/Adminhtml/FaqGroup/MassDelete.php @@ -24,7 +24,13 @@ class MassDelete extends \Magento\Backend\App\Action * @var \Mageprince\Faq\Model\ResourceModel\FaqGroup\CollectionFactory */ private $collectionFactory; - + + /** + * MassDelete constructor. + * @param \Magento\Ui\Component\MassAction\Filter $filter + * @param \Mageprince\Faq\Model\ResourceModel\FaqGroup\CollectionFactory $collectionFactory + * @param \Magento\Backend\App\Action\Context $context + */ public function __construct( \Magento\Ui\Component\MassAction\Filter $filter, \Mageprince\Faq\Model\ResourceModel\FaqGroup\CollectionFactory $collectionFactory, @@ -35,6 +41,14 @@ public function __construct( parent::__construct($context); } + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup'); + } + public function execute() { try { diff --git a/Controller/Adminhtml/FaqGroup/NewAction.php b/Controller/Adminhtml/FaqGroup/NewAction.php index fb1fa85..d462c5d 100755 --- a/Controller/Adminhtml/FaqGroup/NewAction.php +++ b/Controller/Adminhtml/FaqGroup/NewAction.php @@ -34,6 +34,14 @@ public function __construct( parent::__construct($context, $coreRegistry); } + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup'); + } + /** * New action * diff --git a/Controller/Adminhtml/FaqGroup/Save.php b/Controller/Adminhtml/FaqGroup/Save.php index 10877bd..0408507 100755 --- a/Controller/Adminhtml/FaqGroup/Save.php +++ b/Controller/Adminhtml/FaqGroup/Save.php @@ -42,6 +42,14 @@ public function __construct( parent::__construct($context); } + /** + * {@inheritdoc} + */ + public function _isAllowed() + { + return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup'); + } + /** * Save action * diff --git a/composer.json b/composer.json index bc3032a..b47eb24 100755 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Magento2 FAQ Module", "homepage": "https://github.com/mageprince/magento2-FAQ", "type": "magento2-module", - "version": "2.0.0", + "version": "2.0.1", "license": "GPL-3.0-or-later", "authors": [ { diff --git a/etc/module.xml b/etc/module.xml index 1c83b64..28fb696 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -11,5 +11,5 @@ */ --> - +