Questions about PHP permissions

Source: Internet
Author: User
Description of PHP permissions: & nbsp; the system contains various modules. the modules are divided into many submodules. Theoretically, they are infinitely hierarchical modules. You must perform various permission operations on each module. & Nbsp; now some permission packages are added about PHP permissions
Purpose:
The system contains various modules. the modules are divided into many sub-modules. Theoretically, they are infinitely hierarchical modules. You must perform various permission operations on each module.
You can add, delete, modify, query, download, Post, upload, and add new permissions to the permission list. Permission table data structure (permission ID, permission name, remarks ).
Each module contains one or more permissions in the permission table. The permission subset module of the parent module does not have inheritance. that is, it has the permission to modify the parent module of a subset module, however, the subset module does not inherit this permission.
User permissions inherit from user groups, and control user permissions by adjusting User group permissions. A user can belong to only one user group. a user group can have multiple users.

How to implement permission allocation in such circumstances
------ Solution --------------------
Nothing. authorize the user group, and then determine whether all user groups are selected and granted.
Since your permissions are not inherited, you only need to determine the permissions of the current module id.
------ Solution --------------------
Refer to Thinkphp practices! Rbac, easy to manage background permissions!
------ Solution --------------------
Didn't you say that user permissions are the permissions of the group? User permissions inherit from user groups, and control user permissions by adjusting User group permissions.
Now that you have saved all group permissions to the cache file, what do you need to query the database?

When a user logs on, the group to which the user belongs is saved in the session
When entering the module, load the permission cache file of the corresponding group. You save it as code. you only need to include it.
Check the permissions of this module and make corresponding actions. You can.

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.