diff --git a/Controller/Adminhtml/AbstractMassAction.php b/Controller/Adminhtml/AbstractMassAction.php
deleted file mode 100644
index 9b28055..0000000
--- a/Controller/Adminhtml/AbstractMassAction.php
+++ /dev/null
@@ -1,133 +0,0 @@
-getRequest()->getParam('selected');
- $excluded = $this->getRequest()->getParam('excluded');
- try {
- if (isset($excluded)) {
- if (!empty($excluded)) {
- $this->excludedSetStatus($excluded);
- } else {
- $this->setStatusAll();
- }
- } elseif (!empty($selected)) {
- $this->selectedSetStatus($selected);
- } else {
- $this->messageManager->addError(__('Please select item(s).'));
- }
- } catch (\Exception $e) {
- $this->messageManager->addError($e->getMessage());
- }
-
- /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
- $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
- return $resultRedirect->setPath(static::REDIRECT_URL);
- }
-
- /**
- * Set status to all
- *
- * @return void
- * @throws \Exception
- */
- protected function setStatusAll()
- {
- /** @var AbstractCollection $collection */
- $collection = $this->_objectManager->get($this->collection);
- $this->setStatus($collection);
- }
-
- /**
- * Set status to all but the not selected
- *
- * @param array $excluded
- * @return void
- * @throws \Exception
- */
- protected function excludedSetStatus(array $excluded)
- {
- /** @var AbstractCollection $collection */
- $collection = $this->_objectManager->get($this->collection);
- $collection->addFieldToFilter(static::ID_FIELD, ['nin' => $excluded]);
- $this->setStatus($collection);
- }
-
- /**
- * Set status to selected items
- *
- * @param array $selected
- * @return void
- * @throws \Exception
- */
- protected function selectedSetStatus(array $selected)
- {
- /** @var AbstractCollection $collection */
- $collection = $this->_objectManager->get($this->collection);
- $collection->addFieldToFilter(static::ID_FIELD, ['in' => $selected]);
- $this->setStatus($collection);
- }
-
- /**
- * Set status to collection items
- *
- * @param AbstractCollection $collection
- * @return void
- */
- protected function setStatus(AbstractCollection $collection)
- {
- foreach ($collection->getAllIds() as $id) {
- /** @var \Magento\Framework\Model\AbstractModel $model */
- $model = $this->_objectManager->get($this->model);
- $model->load($id);
- $model->setIsActive($this->status);
- $model->save();
- }
- }
-}
diff --git a/Controller/Adminhtml/Post/MassDelete.php b/Controller/Adminhtml/Post/MassDelete.php
index 6873356..d5dbf24 100644
--- a/Controller/Adminhtml/Post/MassDelete.php
+++ b/Controller/Adminhtml/Post/MassDelete.php
@@ -54,4 +54,12 @@ public function execute()
$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
return $resultRedirect->setPath('*/*/');
}
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _isAllowed()
+ {
+ return $this->_authorization->isAllowed('Ashsmith_Blog::post_delete');
+ }
}
diff --git a/Controller/Adminhtml/Post/MassDisable.php b/Controller/Adminhtml/Post/MassDisable.php
index d3dbb4e..dc9d39f 100644
--- a/Controller/Adminhtml/Post/MassDisable.php
+++ b/Controller/Adminhtml/Post/MassDisable.php
@@ -21,6 +21,13 @@ class MassDisable extends \Magento\Backend\App\Action
*/
protected $collectionFactory;
+ /**
+ * {@inheritdoc}
+ */
+ protected function _isAllowed()
+ {
+ return $this->_authorization->isAllowed('Ashsmith_Blog::post');
+ }
/**
* @param Context $context
diff --git a/Controller/Adminhtml/Post/MassEnable.php b/Controller/Adminhtml/Post/MassEnable.php
index c646c28..325aa8a 100644
--- a/Controller/Adminhtml/Post/MassEnable.php
+++ b/Controller/Adminhtml/Post/MassEnable.php
@@ -21,6 +21,13 @@ class MassEnable extends \Magento\Backend\App\Action
*/
protected $collectionFactory;
+ /**
+ * {@inheritdoc}
+ */
+ protected function _isAllowed()
+ {
+ return $this->_authorization->isAllowed('Ashsmith_Blog::post');
+ }
/**
* @param Context $context