Yii2 rbac permission control operation procedure example tutorial, yii2rbac
The topic of this article is detailed operation steps of rbac permission control. Note the operation steps, the tutorial on setting up a perfect backend in yii2 and implementing rbac permission control instances is clear.
However, many people have reported that the menu is completely based on the steps of the primary node, and there is no difference. Why is the menu not displayed? Why is it not displayed? Emma finally found the cause for debugging in the group. The si score is not easy. The reason is that you have learned how to set up and did not learn how to operate! Of course, the premise is that you have successfully built a perfect background and implemented rbac permission control based on the above.
Take creating a user table without adding permissions as an example.
1. Create a user table and complete the creation. This is very simple and we will not elaborate on it.
2, generate model + curd with gii, if you do not operate, you can click the detailed operation steps of the yii2-gii to operate
3. Open the routing page/admin/route/index.
If the/user/* series routes are not displayed in the left-side menu, click the refresh button next to them to refresh.
Now we move the/user/* series on the left to the right
4. Open the permission page/admin/permission/index.
Click the Add permission button and follow the Add name and description.
Click Add. After the permission is successfully added, the details page of the permission will be displayed. As shown in, the/user/* series will be selected and moved to the right.
5. Visit the role list page/admin/role/index to add a role. Just enter the name and description. After the role is added, the details page of the role is displayed, then we just need to move the permission "user management ".
This means that we assign the "user management" permission to the role we just created. In Step 4, we have allocated/user/* series permissions to "user management.
6. Access the assignment page/admin/assignment/index to assign the newly added role to the current user. Note that it is a role, not a Permission. Do not add it again.
7. If you want to display the added operation "user management" on the menu, you need to open the menu list page.
/Admin/menu/index click Add menu.
Related reading:Yii2 rbac permission control menu instance tutorial
At this point, we have basically completed the assignment of/user permissions to the current user. Next, we can access/user/index. If it is normal, it will be okay, that's probably your problem. Let's try again several times.