v. Settings for Rights Management
The crud operation for permissions. 1. Add Permissions
(1) Add a permission controller and add an Add method, and copy the corresponding static page, and modify the static page inside the style picture path.
Think: What is available in the form and what data needs to be put into storage. Modify a form
(2) Create a new privilege model to add data validation and add validation rules
(3) Complete the storage of permissions
(4) In the parent permission location, remove all permissions and display them at the hierarchy level.
Open the privilege model, define the method for fetching permission data, and display it at the hierarchy level.
(5) Remove the data from the Add method inside the controller and traverse it in the corresponding static page
2. Permissions List
Add a LST method to the controller, and copy the corresponding static page, modify the path of the style and picture, the user obtains the permission data
Traverse the extracted data to a static page and add the deleted and modified connections
3. Modify Permissions
(1) Add a Save method to the privilege controller, remove the currently modified data and display it to the corresponding static page,
(2) When you perform the Modify permission, you should be careful not to regard your own child permissions as their parent permissions.
Add a method to the privilege model to remove the ID of the child permission
(3) The ID of the child permission is taken out according to the ID, if it is its own child permissions or not displayed when the static page is traversed.
Note: Change the previous Save method to update, the template file to update.html, the list of links to update, a total of three places.
(4) To complete the modification operation, when modifying the database, also to verify that the parent ID is the ID of their own child rights and their own ID,
Using a hook function, the hook function is defined inside the model and is automatically triggered when the modification is completed.
6 Hook functions:
_before_insert
_after_insert
_before_delete
_after_delete
_before_update
_after_update
The contents of the hook function:
4. Delete Permissions
20150403--rbac+ Home Login-02