20150404--rbac+ Plumbing Authority-01

Source: Internet
Author: User

Catalogue

first, Rights Management settings 1

1 , delete permissions 1

second, role management 2

1 , add roles, 2

2 , role list 5

3 , role deletion 6

III. Administrator Management 6

2 , administrators list, 9

3 , modify Administrator 9

Five, Model Management 12

six, column management 13

vii. Content Management One, Rights Management settings 1, delete permissions

When you delete a permission, you cannot delete it if you have child permissions. Before deleting, decide whether you have child permissions.

(1) Define a method in the model that verifies the child permissions.

(2) Add a Delete method to the privilege controller. Used to delete permissions

second, role management 1, add the role,

When adding a role, to assign permissions to the current role, it involves two tables,

One is the It_role table (field: role name), one table is It_role_privilege (ID of the role and the IDs of the permissions)

(1) Create a new role controller, add a method, copy the corresponding template page, and modify the path of the style picture.

(2) Add a JS event, when the sub-permissions are selected, the upper permission is selected.

(3) Create a new role model, add data validation,

(4) Add a hook function _after_insert () to the role model, and the function completes the inbound It_role_privilege table

(5) How to modify and add a role

2. List of roles

(1) Create a new LST method, copy the corresponding static page, and modify the path of the style and picture

Requirements: The name of the role, and the names of the role corresponding permissions are also listed.

Thinking: The table in which the permission name resides, the table in which the role name resides, and the role and permissions of the intermediate table

Select from It_role a left joins It_role_privilege B on a.id=b.role_id left joins It_privilege C on c.id=b.pri_id

Group_concat (field name) stitching the queried fields into a comma-separated string.

To traverse in a static page:

3. Role deletion

Requirements:

(1) In deleting the role, to empty the It_role_privilege table inside the role ID corresponding to the permission ID

(2) The role cannot be deleted if an administrator is part of the role.

Add a _after_delete ($data, $options) method to the character's model.

To delete the ID of the role's corresponding permission in the It_role_privile table

20150404--rbac+ Plumbing Authority-01

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.