User rights management under the laravel51 framework 360 rights management User rights management Router management rights

WBOY
Release: 2016-07-29 08:49:45
Original
1035 people have browsed it

Developing a website must involve user management. How to decide whether a user is an ordinary user, administrator or super administrator?

Here is a description combining the laravel5.1 framework and PHP language:

1. First we need to create a users table in the database, which needs to contain the type field and fill in false data (normal users correspond to 0, administrators correspond to 100, super administrator corresponds to 110)

2. Then edit the AuthenticatesUsers.php file of the laravel5.1 framework (/vendor/laravel/framework/src/illuminate/Foundation/Auth). The screenshot is as follows:

干部管理权限,权限管理系统,qq权限管理,root权限管理,supersu权限管理,管理权限设置,java权限管理,laravel thinkphp,手机权限管理,权限管理软件,管理权限登录,超级权限管理,360权限管理,用户权限管理,路由器管理权

3. The variable $user obtains the information of the logged-in user, and then passes it into the three functions isStudent, isAdmin, and isSuperAdmin. Let’s take a look at these three functions:

View User.php (/app/models), the file is in As a model under the laravel framework, simply speaking, it corresponds to the users table in the database

干部管理权限,权限管理系统,qq权限管理,root权限管理,supersu权限管理,管理权限设置,java权限管理,laravel thinkphp,手机权限管理,权限管理软件,管理权限登录,超级权限管理,360权限管理,用户权限管理,路由器管理权

4. Find the corresponding type field from the database according to the information (name) filled in by the user, and correspond to the config directory File (mooe.php) for comparison:

干部管理权限,权限管理系统,qq权限管理,root权限管理,supersu权限管理,管理权限设置,java权限管理,laravel thinkphp,手机权限管理,权限管理软件,管理权限登录,超级权限管理,360权限管理,用户权限管理,路由器管理权

5. The judgment here determines which branch the program enters the file AuthenticatesUsers.php (the first screenshot), corresponding to different routes /homestudent /homeadmin /homesuperadmin and then in the route ( routes.php) into different controllers.

The above introduces the user rights management under the laravel51 framework, including laravel and rights management. I hope it will be helpful to friends who are interested in PHP tutorials.

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!