RBAC is a simple implementation of role-based permission management and rbac role permission management. RBAC is a simple implementation of role-based permission management. rbac role permission management 1. what is permission management? permission management is a subdivision of background functions, role-Based permission management and RBAC role permission management.
1. what is permission management? permission management refers to the subdivision of background functions and the management of Jobs divided by different employees
How RBAC is implemented is managed by limiting the methods of different controllers and controllers.
To implement RBAC, three tables, one user table, one role table, and one permission table are required.
User table:
Id ****** role_id
Role table
Role_id ****** access_ids (record all accessible permission IDs)
Permission table
Access_id
Records the actions of all controllers or controllers.
2. how to control it? just make a judgment in the parent class of the controller or the initialization method of the controller.
$ Role_id = $ _ SESSION ['role _ id'];
$ Role = $ db-> role-> findByPk ($ role_id );
$ Access = $ db-> access-> findAllByPk ($ role ['Access _ id']);
Obtain the controller or controller method to be executed based on the vro class
$ M = current_method (); // Obtain the method to be accessed
If (! In_array ($ m, $ access )){
redirect(‘/index’);
}
Http://www.bkjia.com/PHPjc/1001455.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1001455.htmlTechArticleRBAC role-based permission management based on the simple implementation, rbac role permission management 1, what is permission management, permission management is the subdivision of the background functions, and different staff division...