Jeecg Simple example to explain permission control
Post address:http://blog.itpub.net/30066956/viewspace-1868754/
Xu
First, business background
A company wants to implement a log system to understand the workload saturation of employees.
Second, demand
1, the role is divided into: employees, managers two kinds.
2, the staff daily in the log system to complete the summary, and then the manager to review.
3, the form content contains: name, date, summary, personal notes, journal reviews.
Iii. Description of Business rights
1, the employee can make the log fill, view operation. (Button control permissions)
2, the manager can carry on the journal Review, the view operation. (Button control permissions)
3, personal note content only for the completion of my visible, the manager can not see the personal note content. (Form field permissions)
4, the manager can only edit the journal review field. (Form field permissions)
5, the employee query out the data list listed as
Name, date, personal note, journal reviews (data column permissions)
6, the manager query out the list of data listed as
Name, date, journal reviews (data column permissions)
7, employees can only see their own log records. (data row permissions)
Iv. Development process
1. Create a form:
2. Edit Page Properties
3. Synchronizing the database
4, test View form content as follows
5. Generate Code
6. copy The code into the project.
7. New two roles: employees, managers; new three users: Employee small A, employee small B, manager Wang. and assign the corresponding roles.
8. Configuration Menu
9. Assign a menu to the employee and manager role
Use manager Wang to log in and test to see the Logbook menu. However, the required permissions have not been controlled yet. and the resulting page style is a bit problematic.
10, adjust the page style, modify the button text, delete the unused button.
Five, permissions configuration
Permissions are described below
1, the employee can make the log fill, view operation. (Button control permissions)
Configure log reviews the button is not visible and works for the employee role.
A, in the code, the log Reviews button added operationcode= "Update"
B. In menu management, add control permissions to the Logbook menu: Log reviews hidden
C, in role management, the employee role is controlled with this permission.
D, testing, you can find that using employee A and employee B login has not seen the journal reviews.
2, the manager can carry on the journal Review, the view operation. (Button control permissions)
The Configure Log Fill button is not visible and works for the manager role.
The process is above one.
3, the employee query out the data list listed as
Name, date, personal note, journal reviews
The list of data that the manager queried is listed as
Name, date, journal reviews (data column permissions)
Configure the Personal note column to hide and work with the manager role.
A, add control permissions under the employee log.
B. Use this permission for the manager role.
C, the test is as follows, Wang Manager login has not seen a column of personal notes.
4, employees can only see their own log records. (data row permissions)
Configuring the DataGrid operation createby =#{ Sys_user_code}
a, the new access type of the menu. Note: Be sure to access the type. The path is the list query action.
B. Add data permissions to the newly added access type menu.
C. Use this data permission for the employee role.
D. Use employee A, employee B to enter data respectively. Test everyone can only see the data they have entered.
5, the personal note content only to fill in the staff visible, the manager cannot see the personal note content. (Form field permissions)
Configuring a Personal note form field is not visible and works for the manager role.
A, in the new page, for the review line plus t:authfilter Mark
B. New Access Type menu
C. Add control permissions to the newly added menu
D. Use this permission control for the employee role.
E, test, found the log reviews in the log fill out the page has no.
6, the journal review page, the manager can only edit the journal review field.
The log Reviews page uses the readonly property for all other fields .
This feature shows that although the permissions are easy to configure, changing the page or method is sometimes more convenient.
Complete!
Jeecg Simple example to explain permission control