Ask for the PHP website management administrator permission control system solution

Source: Internet
Author: User
Ask for the PHP website background management administrator permission control system solution. The younger brother is now working on a website background, including the article Upload module for uploading downloaded files and the user message module. Problem: background administrator permission assignment description: the system now has a super administrator with all permissions. To achieve this, the super administrator can add a general administrator and control the permissions of the general administrator. For example, if you want to control that a common user can only upload articles, ask for the PHP website background administrator permission control system solution.
The younger brother is now working on the background of a website, including the article Upload module for uploading downloaded files and the user message module.
Problem: backend administrator privilege allocation

Note: The system has a super administrator with all permissions. To achieve this, the super administrator can add a general administrator and control the permissions of the general administrator. For example, how does one control that a common user can only upload an article but not an image? For more information, it is better to have a source code instance!

In addition, the system may add other modules (such as adding an image Upload module). after adding a background module, how can we easily configure the permissions of the original administrator account on the newly added module?

You may not be clear about this. if you have any questions, please follow the instructions!

The maximum score is 100. I wonder if I can add more points!


------ Solution --------------------
Each permission requires a tag.

For example:

Publish Post 1

Add administrator 2

Image Upload 3

...........

If the user has three permissions

Saved database, which is an array (1; 2; 3)

Users can only publish posts (2 ;)

Permission to publish posts and upload images (2; 3 ;)

...........

When determining whether to grant permissions, you only need to check whether the permissions are included ..

I don't know ??
------ Solution --------------------
Create a module table. If you have the right to operate on this module, it is 1. Otherwise. 0


1 0 1. flexible use
------ Solution --------------------
Create a module table. the module table contains admin_group_id, which can be viewed by administrators and users.
User mode fast 1, 3 -- 1 indicates the highest administrator, and 3 indicates the user
Upload Module 1, 2 -- 1 indicates the highest administrator, and 2 indicates the general administrator.
------ Solution --------------------
Create a module table. the module table contains admin_group_id, which can be viewed by administrators and users.
User mode fast 1, 3 -- 1 indicates the highest administrator, and 3 indicates the user
Upload Module 1, 2 -- 1 indicates the highest administrator, and 2 indicates the general administrator.
------ Solution --------------------
Phpgacl
------ Solution --------------------
Discussion
Each permission requires a tag.

For example:

Publish Post 1

Add administrator 2

Image Upload 3

...........

If the user has three permissions

Saved database, which is an array (1; 2; 3)

Users can only publish posts (2 ;)

Permission to publish posts and upload images (2; 3 ;)

...........

When determining whether to grant permissions, you only need to check whether the permissions are included ..

I don't know ??

------ Solution --------------------
Most of the above are simple permissions.
For complex permission role models, search for them online.
------ Solution --------------------
Easy to use group

Group table:
Group id/group name
1/Group 1
2/Group 2
............

Permission table:
Permission id/name
1/permission 1
2/permission 2
3/permission 3
............

Group permission Association table:
Group id/permission id
1/1
1/2
2/2
2/4
............

Randomly match. group 1 may be your supermanager, group 2 is the general manager, and you create a new group 3. Create Group 4, which may be restricted users
------ Solution --------------------
Let's take a look at dedecms's permission management. I think it's very flexible.
------ Solution --------------------
Discussion
Thank you for your comments.

Another problem: if the system adds other modules (such as adding an image Upload module), after the background module is added, how can I easily configure the permissions of the original administrator account on the newly added module?

------ Solution --------------------
I was working on this permission issue two days ago,

I designed several tables myself.

Used under zend auth. for details, refer

/* Role table
-- Id
-- User name
-- Password
-- Workgroup A, B, C...
*/
Drop table if exists role_acl;
Create table role_acl (
Id int (11) not null auto_increment,
Username varchar (30) not null,
Password varchar (20) not null,
Work_group char (1) not null,
Primary key ('id ')
) ENGINE = InnoDB default charset = gbk;
/* Working Group
-- Id
-- Workgroup A, B, C...
-- Text description
*/
Drop table if exists group_acl;
Create table group_acl (
Id int (11) not null auto_increment,
Work_group char (1) not null,
Group_desc varchar (60) not null,
Primary key ('id ')
) ENGINE = InnoDB default charset = gbk;
/* Role resource action ing table
-- Id
-- Workgroup A, B, C...
-- Resource Code
*/
Drop table if exists mapped_acl;
Create table mapped_acl (
Id int (11) not null auto_increment,
Work_group varchar (1) not null,
Resource varchar (20) not null,
Action varchar (20) not null,
Primary key ('id ')
) ENGINE = InnoDB default charset = gbk;

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.