BOS Project Note 8 days
Today's content arrangement:
1, Rights Management (initialization, query, add)
2. Role management (Add, query)
3, user management (Add, query)
4.Modify The authorization method in the custom Realm (based on the database implementation)
5. Use ehcache to cache permission data
6, the system left menu according to the rights of the login dynamic display
1.
Rights Management 1.1
initializing permission data
execute SQL script file initialization permission data:
1.2
Permissions paging query
The first step: Modify the URL Address of the DataGrid in the page to access the functionaction Paging Query method for pagequery
Step Two: Create Functionaction
Step Three: Configure Struts.xml
Troubleshoot paging queries:
L Way One: Modify the fields of the permission table and the properties in the corresponding permission class page
L Way Two: gets page injection from the model object into the pagebean Object
1.3
Permissions add function
First Step: Modify the URL Address of the ComboBox in the Add page , query all permissions, show to the dropdown box
Step Two : in the Listajax methods available in functionaction
Step Three: Modify the name Property of the combobox
Fourth step: Submit a form for the Save button binding event
Fifth step: in The add method is provided in the Action to save a permission data
Service Code:
2.
Role Management 2.1
Add roles feature
First step: Use ztree to show permission tree, turn on ztree Check effect
Step Two: Modify the URL address of the Ajax method, access the Action, query all permission data, return simple JSON data as node data for Ztree
The third step: To save the button binding event, submit the form, the selected node is not committed, using the API provided by Ztree to obtain the currently selected node, given the specified hidden field
Fourth Step: Create Roleaction, providing the add method
Service Code:
Fifth Step: Configure Struts.xml
3.
User Management 3.1
Adding user features
First step: Send an AJAX request, get all the role data, return the JSON, construct a checkbox
Step Two : in the Listajax methods available in roleaction
Step Three: Perfecting The callback function of the Ajax method
Fourth step: Submit a form for the Save button binding event
Fifth step: in The add method is provided in useraction to save the user
Service Code:
Sixth step: Configure Struts.xml
Seventh step: in The getformatbirthday method is available in the User class , and the returned JSON contains formatebrithday Field
Eighth Step: Modify the field name in the userlist.jsp page
4.
Modify The authorization method in the Bosrealm
in the A method for querying permissions based on the user ID is provided in Functiondao:
5.
using ehcache to cache permission data
First step: Import Ehcache in the jar Package Project
Step Two: Provide an XML configuration file for Ehcache (available from the jar package)
Step Three: Register a cache manager in the spring configuration file and inject it to the security manager
6.
the left menu of the system is displayed according to the rights of the login
First Step: Modify the URL of the Ajax method in the index.jsp page
Step two: in Findmenu methods available in functionaction
step three: in methods available in Functionservice
Fourth step: in extension methods in Functiondao
BOS Project 8th Day (Rights Management Add, role Management Add, user Management Add, Shiro permissions framework using Ecache cache)