The first thing to understand is that a table is required to record the entire project controller and method, so that when the permission detection can detect the database corresponding to the role of the controller or method permissions,
However, it is necessary to understand that in the development process, it is necessary to remove this permission, so that in the development process is the need to add a controller or method does not need to verify permissions, and then after the development of the need
Increase the Controller and method in the Permissions table.
General role-based permissions control, you need to use the following tables
1. User table 2, Permissions table, 3. Role table, 4 Permissions role Relationship table 5 user Role Relationship table
This way is the user through, the User Role Relationship table query out their role, and then through the Permissions Role Relationship table isolated, and then the permission table is the Cartesian product of the controller and method, and then
Querying the database to get a two-dimensional array of controllers and methods, and then obtain the current controller and method based on the thinkphp keyword to get whether in the two-dimensional array, you can let the current user can access
General permissions control The initialization method written on the underlying controller, such as Basecontroller,admincontroller, and then all the controllers that inherit these controllers will automatically verify their permissions, without having to write the
Role-based permissions control