A little experience in software authority settings

zhaozj2021-02-16  53

I am a little bit of personal experience in the software development process, I will share it with everyone, I hope everyone can more valuable.

In the past, most articles are set up to be implemented through the ActionList and the permissions table in the database. I have passed the TAG attribute of the control (each control has a reserved tag property, the default is 0), and the setting of the permissions can be implemented. Here I will implement the implementation method.

1. Put all the TAG properties of the menu and button that need to set the permissions (1, 2, 3 ...), not using 0 (the default value of the control tag attribute), indicating This control does not require permission settings.

2. Plus all permissions name to checkboxlist, including menus and buttons, and the order must be exactly true to the order of assigning Arabic numbers.

3. Establish an operator table (including the number, name, permissions) permission in the database, using a string containing only 0 and 1. Use 0 indicates a corresponding permissions (corresponding menu or buttons available, enabled = true), with 1 indicates no corresponding permissions (corresponding menu or buttons are not available, enabled = false). This field is to set enough (I reserved 50) for expansion.

4. Set the main code of the permissions as follows:

/ * QX, user permission string, Operator operator table, privilege permission field * / Ansistring QX = ""; for (i = 1; i <= checklistbox1-> items-> count; i ) {if (checklistbox1-> Checked [i-1]) {qx = qx "0";} else {qx = qx "1";}} SQL = "Update Operator set privilege = '" qx "' where operator_name = '" cbooperatorname-> TEXT "'"; 5, set the user's global variable, add the permissions to the form of the FormShow event as follows:

转载请注明原文地址:https://www.9cbs.com/read-24643.html

New Post(0)