The theme of this article is RBAC permission control detailed operation steps, attention is the operation step Oh, about configuration and RBAC, we build perfect backstage and realize RBAC Control Example tutorial of Yii2.
However, in a lot of people's feedback, said is completely in accordance with the steps of the master, no less, why the menu does not show, why not show it? Emma, finally in the group to help people to find the reason for debugging, Si points is not easy ah. The reason is that you have learned to build did not learn to operate Ah, ah, ah, we will come to the detailed today to say that the rights of RBAC control specific how to operate! Of course, the premise is that you have been in accordance with our successful establishment of a set of perfect backstage and the implementation of RBAC rights control.
To create the user table without adding permissions for example.
1, create the user table, and then the crackling of the creation of the complete, very simple we will not elaborate
2, to generate Model+curd in GII, if you do not operate, you can click Yii2-gii Detailed procedures to operate
3, we open the routing page/admin/route/index will probably appear in the following image of the interface
If your left menu does not appear in our/user/* series route above, click the Refresh button next to it to refresh.
Now we move the/user/* series on the left to the right
4, we open the permission interface/admin/permission/index
Click the New Permission button to add a name and description in the following figure
Click Add, Success will jump to the details page of the permission, as shown in the following figure, we select the/user/* series to move to the right
5, we access the Role List page/admin/role/index add a role, only fill in the name and description can be, add success will jump to the role of the details page, and then we follow the figure just to the right "user management" moved on the line
This means that we assign the user admin permission to the role we just created, and in step fourth we have assigned the/USER/* series permissions to user management.
6, we access the Assignment page/admin/assignment/index assigns the role just added for the current user. Note is the role Oh, not permission, do not repeat Add.
7, if we want to just add the operation "User management" displayed on the menu, we also need to open the menu list page
/admin/menu/index Click the Add menu.
Related reading: Yii2 RBAC Privilege Control Menu Instance Tutorial
To this end, we give the current user to assign/USER permission operation is basically completed, the following we can visit/user/index to see it, normal is OK, if there is no still hint not permission, that is your thing, and then to do more than a few times of the Sao years.