Skip to content

Commit

Permalink
Solve admin user roles resources issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mageprince committed Apr 23, 2020
1 parent 37d3397 commit 474e416
Show file tree
Hide file tree
Showing 16 changed files with 129 additions and 6 deletions.
8 changes: 8 additions & 0 deletions Controller/Adminhtml/Faq/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
8 changes: 8 additions & 0 deletions Controller/Adminhtml/Faq/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ public function __construct(
parent::__construct($context, $coreRegistry);
}

/**
* {@inheritdoc}
*/
public function _isAllowed()
{
return $this->_authorization->isAllowed('Mageprince_Faq::Faq');
}

/**
* Edit action
*
Expand Down
8 changes: 8 additions & 0 deletions Controller/Adminhtml/Faq/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public function __construct(
parent::__construct($context);
}

/**
* {@inheritdoc}
*/
public function _isAllowed()
{
return $this->_authorization->isAllowed('Mageprince_Faq::Faq');
}

/**
* Index action
*
Expand Down
8 changes: 8 additions & 0 deletions Controller/Adminhtml/Faq/InlineEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ public function __construct(
$this->jsonFactory = $jsonFactory;
}

/**
* {@inheritdoc}
*/
public function _isAllowed()
{
return $this->_authorization->isAllowed('Mageprince_Faq::Faq');
}

/**
* Inline edit action
*
Expand Down
20 changes: 17 additions & 3 deletions Controller/Adminhtml/Faq/MassDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions Controller/Adminhtml/Faq/NewAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ public function __construct(
parent::__construct($context, $coreRegistry);
}

/**
* {@inheritdoc}
*/
public function _isAllowed()
{
return $this->_authorization->isAllowed('Mageprince_Faq::Faq');
}

/**
* New action
*
Expand Down
8 changes: 8 additions & 0 deletions Controller/Adminhtml/Faq/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ public function __construct(
parent::__construct($context);
}

/**
* {@inheritdoc}
*/
public function _isAllowed()
{
return $this->_authorization->isAllowed('Mageprince_Faq::Faq');
}

/**
* Save action
*
Expand Down
7 changes: 7 additions & 0 deletions Controller/Adminhtml/FaqGroup/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions Controller/Adminhtml/FaqGroup/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ public function __construct(
parent::__construct($context, $coreRegistry);
}

/**
* {@inheritdoc}
*/
public function _isAllowed()
{
return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup');
}

/**
* Edit action
*
Expand Down
8 changes: 8 additions & 0 deletions Controller/Adminhtml/FaqGroup/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ public function __construct(
parent::__construct($context);
}

/**
* {@inheritdoc}
*/
public function _isAllowed()
{
return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup');
}

/**
* Index action
*
Expand Down
8 changes: 8 additions & 0 deletions Controller/Adminhtml/FaqGroup/InlineEdit.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ public function __construct(
$this->jsonFactory = $jsonFactory;
}

/**
* {@inheritdoc}
*/
public function _isAllowed()
{
return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup');
}

/**
* Inline edit action
*
Expand Down
16 changes: 15 additions & 1 deletion Controller/Adminhtml/FaqGroup/MassDelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand Down
8 changes: 8 additions & 0 deletions Controller/Adminhtml/FaqGroup/NewAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ public function __construct(
parent::__construct($context, $coreRegistry);
}

/**
* {@inheritdoc}
*/
public function _isAllowed()
{
return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup');
}

/**
* New action
*
Expand Down
8 changes: 8 additions & 0 deletions Controller/Adminhtml/FaqGroup/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ public function __construct(
parent::__construct($context);
}

/**
* {@inheritdoc}
*/
public function _isAllowed()
{
return $this->_authorization->isAllowed('Mageprince_Faq::FaqGroup');
}

/**
* Save action
*
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Mageprince_Faq" setup_version="2.0.0"/>
<module name="Mageprince_Faq" setup_version="2.0.1"/>
</config>

0 comments on commit 474e416

Please sign in to comment.