In the permission design, how to distinguish the permissions of the tree-like function list and the page buttons, and how to determine whether to display the page buttons according to the permissions

Problem Description

Do any seniors have relevant and optimal design ideas and experience, please share them, thank you

solution

The tree function is the same as the normal function. Do a function permission control: a role corresponds to multiple function modules, and the current user's role is obtained when querying, and then only the functions owned by the current role are assembled into a tree button when the tree is generated. The permissions are the same. You can name the buttons in the function uniformly, such as adding: add; modifying: edit, etc., all the buttons in the function follow this naming rule. In the button permission control, we first select the role, and then select the corresponding function , And then configure the corresponding button permissions. When displaying, judge whether the current role has the permissions of the current button. If you have it, you will display it. If you don’t have it, you won’t. The button can be encapsulated into a corresponding label, which can save a lot of things.
Solution 2:
Resources, including menu name, button name, page name, method name, etc. pid and service_view are combined together as the main key, indicating that multiple resources can be compiled into one code (such as the permission of a button, often also including the corresponding page, method, etc. Many permissions, you can encode these associated permissions into a code, so that when granting either all or none) Table 2 Permission resource table table name: tbl_perm_res (permission resource) category (table) field name field alias data type primary key allowed Empty/display default value description pid permission code varchar(50)YN/Nparent_id superior permission code varchar(50)type permission category char(1)N/N1, top menu, 2, menu and page, 3, button explain description varchar( 50) Y/N Remarks: ①. Specially configure the superior-subordinate relationship of all resources so as to display and grant rights in the form of resource tree on the page where permissions are allocated. We generally start from the menu on the left side of the system. The top menu is the top node of the resource tree, and the submenu is once a subresource. Pages, page buttons, request paths, and methods are all subresource nodes of a certain module...②, pid and parent_id are all Coding the resources in the table tbl_res_map in advance. Table 3 User authority table name: tbl_auth (user authority) category (table) field name field alias data type primary key allow empty/display default value description uid account/role varchar(50) YN/Nutype category charYN/N1, user, 2, role pid permission number varchar(50) YN/N Remarks: pid source tbl_perm_res in the pid table 4 role table table name: tbl_role (role) category (table) field name field alias Data type primary key is allowed to be empty/display default value Description role_id role number varchar(50)YN/Nrole_name role name varchar(50)N/Y Remarks Table 5 User role mapping table Table name: tbl_user_role (user role mapping table) Category (table) Field name, field alias, data type, primary key, allow to be empty/display default value Description role_id role number varchar(50)YN/Nuser_id user number varchar(50)YN/N Remarks Table 6 User table table name: tbl_user (user)
Solution 3:
The control of permissions is very complicated. Use a clear mind to analyze this. Usually relatively simple permission settings, such as servlet or struct, we can use filters or interceptors to control access to certain files. But according to your requirements, you need to control the function list and buttons, so you need to consider a little more. Your authority cannot be based on controlling the url connection, but must turn to the control of a method: general authority control, there are four control methods C(reate) R(etrieve) U(pdate) D(elete) that is to say , Generally, your Action types have several fine element operations such as create, query, update, and delete. Finally, your control is summarized as these points. You add a table in the database to control the CRUD operation authority of a certain Action. 1. When controlling the buttons, you can control the display through css . 2. The function list is not recommended to use js or css, but to create a tree through the background json is the best.
Solution 4:
This permission is very detailed. The nodes of the tree and the page buttons are all treated as resources to manage

Guess you like

Origin blog.csdn.net/h610443955/article/details/81774184