In this article we're going to learn how to restrict admin access in a Magento 2 store. This feature is particularly useful when working with freelancers, as it enables you to hide sensitive information such as your sales data, for example.
1. Create a new role
The first step is to create a new role. To do so, login to your Magento admin panel and go to SYSTEM > PERMISSIONS > USER ROLES
Then, create a new role by clicking on the ADD NEW ROLE button
Following that, In the role information tab, fill out the role name (i.e Freelancers)
Now comes the important bit. In the Role Resources tab, select the resource access you wish to grant your Freelancers.
In my example, the freelancers I'm working with are going to be responsible for uploading new products and for writing blog posts. Therefore, I've granted them access to the Products and Content sections on my store.
Then, click on the SAVE ROLE button.
2. create a new user & ASSIGN THE USER TO A USER ROLE
Next, it's time to create individual users (in Magento) for each of your freelancers. To do so, go to SYSTEM > PERMISSIONS > ALL USERS.
Then, click on ADD NEW USER.
Fill out the information in the User Info tab.
Then, in the User Role tab, assign your user to the Freelancers role.
Finally, press the Save User button. The new account has now been created.
When the Freelancer Jon Snow logs in, he will only be able to have access to the Products and Contents sections of my website.