Php permission management

Source: Internet
Author: User
How does php perform permission management? How does php design permission allocation after login? for example, six people have different system permissions. how can I design a database, how can I determine different permissions after logging on to the system?


Reply to discussion (solution)

Http://bbs.csdn.net/topics/390610933


The table relationship is clear, and you need to complete the function on your own.



The table relationship is clear, and you need to complete the function on your own.
Alas, I can't understand it. I 've always been using a stupid method ~~

It doesn't need to be so complicated. it's just a combined game.

$ D = array ('browsed ', 'new', 'modify', 'delete'); $ u = array (,); foreach ($ u as $ k) {echo "\ n $ k"; foreach ($ d as $ p => $ v) echo $ p = ($ p & $ k )? $ V :'';}
0 browsing
1. browse New
2. browse and modify
3. browse new, modify, and delete

You need to determine the use of RBAC1, RBAC2, RBAC3 as needed, but the principles are similar.

The method I often use is
Administrator 1:
{
[Permission type 1] => [read, write, repair, delete],
[Permission type 2] => [read],
...
}
Check (permission type, permission)

This should be designed based on your needs. If your permission division is simple, such as adding, deleting, modifying, and querying permissions for data objects, you can directly refer to the linux directory access permission code design without setting the "role" prototype. If it is more complex, you can refer to the design on the second floor. I think the design on the second floor is suitable for complicated permission management.

You can refer to the RBAC management of ThinkPHP to set up three tables, one user table, one permission table, and one role table. when the three tables are associated, the RBAC permission management is constructed, with this idea, we can build a very good permission management platform.

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.