RBAC Privilege Management in PHP


1. RBAC Concept and Principle

RBAC: The full name is Role-Based Access Control. The Chinese translation is called role-based access control. Its main function is to realize the control of project authority.

Effect: Different administrators can access different pages. For example, operators can only see the operation-related modules. Financial personnel can only see financial related modules.

Traditional authority management:

              RBAC privilege management:

             RBAC privilege management:

Privilege management is relatively standardized, and the privileges of roles can be defined according to certain standards.

Administrators can have corresponding permissions by specifying roles.

2. Data sheet design:

              Basic Data Table: Administrator Table, Role Table, Permission Table

Correspondence: Administrators correspond to one role and one role corresponds to multiple permissions. (An administrator can also correspond to multiple roles)

Maintenance of correspondence:

The first one is three-table structure, adding role ID field in administrator table, adding authority IDS field in role table, and finally three tables.

The second is the five-table structure, adding an administrator role association table and a role permission Association table. The final five tables.

               Here we take the three-table structure as an example:

Query the permissions of an administrator:

First query the administrator table to get the role ID

Query the role table again to get the permission IDS you have

Finally, query the permission table according to permission ids, where id in (1, 2, 3)

Recommended Today

The method of obtaining the resolution of display by pyqt5

The code is as follows import sys from PyQt5.QtWidgets import QApplication, QWidget class Example(QWidget): def __init__(self): super().__init__() self.initUI() #Interface drawing to initui method def initUI(self): self.desktop = QApplication.desktop() #Get display resolution size self.screenRect = self.desktop.screenGeometry() self.height = self.screenRect.height() self.width = self.screenRect.width() print(self.height) print(self.width) #Show window self.show() if __name__ == ‘__main__’: #Create applications and objects app […]