Home>Article>Backend Development> How to set administrator permissions in php

How to set administrator permissions in php

藏色散人
藏色散人 Original
2020-11-17 09:08:37 4062browse

How to set administrator permissions in php: first create the administrator table, management group table and rule table; then use the common design method RBAC, that is, to implement permissions by authenticating the current access URI. Just set it up.

How to set administrator permissions in php

Recommended: "PHP Video Tutorial"

Specific questions:

PHP-Backend permission management design issues

Has anyone done the background permission management module? Can you tell me your design ideas? It’s okay to have some documents for me to look at (I also looked for information on the Internet before I asked the question. Don’t let me Baidu it myself? I’m heartbroken...)

That’s what I think, there are three Tables, administrator table, management group table, rule table

管理员表(members) m_id m_name m_passw m_groupid 管理员ID 用户名 密码 管理所对应的管理组ID 规则表(rules) r_id r_name r_method r_status 规则ID 规则名 控制器名/方法名 状态 管理组(group) g_id g_name g_content 组ID 组名 组权限(包含这一组所有的规则ID)

As shown in the above code, I think three tables can handle it. Why do I see 6 or 7 tables on the Internet? There are association tables or mapping tables in the middle. I want to know, what are the specific functions of so many tables? The actual operation (operating the database) is still very complicated. If it is necessary, what is its specific function? Please answer your doubts

Solution:

Common design method RBAC:

Design idea: perform permission authentication on the current access URI

Data structure:

Table 1: Permission table, used to store all access URIs

Table 2: Permission group table, to store the URIs that the permission group has access permissions id

Table 2: Permission group, which users correspond to the permission group

This is roughly the idea

The above is the detailed content of How to set administrator permissions in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn