Home > Database > Mysql Tutorial > How roles and permissions control data tables

How roles and permissions control data tables

巴扎黑
Release: 2017-07-22 13:20:00
Original
1691 people have browsed it


This project requires regional division of roles. Each role corresponds to one or more third-level cities. When logging in in the background, you can only view business opportunities in the area you are in.

First create the account table: fields include: account id, role id, login account, login password, account name, status, number of login errors, and account user information

Then comes the role table: role id, parent Role id, role name, role level, status, remarks and others. Associate areas and permissions

Then there is the role area table: area id, role id, first-level city code (provincial level), second-level city code (municipal level), third-level city code, first-level city Name, second-level city name, third-level city name. What is saved is the area managed by the corresponding role

The following is the role permission table: permission id, role id, permission id, permission status, and others. What is saved is the permissions owned by the corresponding role

The last is the permission table: permission id, parent permission id, permission name, corresponding permission value (unique value of permission), permission type, permission status. The permission table saves all menu items. When clicking the menu, first verify whether the currently logged-in administrator has this permission

Of course the database has a table to store all provinces, cities, counties and streets in the country

Process: First save all menu items to the permission table. Before adding an account, you must first add a role --> When adding a role, you need to select the area and assign permissions

The above is the detailed content of How roles and permissions control data tables. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template