Magento: remove admin mass action for specific role

Posted by Andrew McCombe on Tue Aug 15, 2017

I had a use case where a Magento admin user was limited to viewing the orders only. They should be able to view orders but not perform any actions on an order. The best way to do this with Magento is to remove admin mass actions for a specific user role.

Firstly I set up a role with the name ‘Read Only’ and limited access to the Orders list only:

Magento admin roles

Then I created a user and assigned them to that role.

Code changes

To remove the mass action sections you need to override the default sales order grid and override the getExportTypes(), getRssLists(), and _prepareMassaction() methods.

Firstly, set up your module config to override the sales grid:

Now create your block in Example/Module/Block/Adminhtml/Sales/Order/Grid.php

Finally, implement a helper in your module to check the admin role: