Question

In magento 2, the product grid massaction are added via ui_component. My requirement is, to disable the product delete if the user has no permission. Not getting how to do that in magento 2.

In magento 1, used the grid rewrite to change the massaction. Let me know, if there is as way to make the massaction permission based in magento 2.

Was it helpful?

Solution

I didn't get any solution to the above problem. Instead, i have used preference to override the permission in the controller class for the delete product page.

Now, when user click on the delete massaction, the preference class will check if the user has permission, if no permission then change _isAllowed function to return false to show no permission page.

<preference for="Magento\Catalog\Controller\Adminhtml\Product\MassDelete" type="VendorName\ModuleName\Controller\Adminhtml\Catalog\Product\MassDelete" />
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top