The most simplified permission management system, developed based on Laravel5.5. Please switch to any54
branch for Laravel5.4 version.
Any
is a new and simplified management backend module, including the simplest permission control. When I first wrote the permission system, I read the source code written by a foreigner. Based on his code, I wrote a backend based on Laravel5.2 IAdmin
. This is the original permission system. For public use, all permissions are written in the configuration file.
iDashboard
optimizes the design ideas and code structure based on IAdmin
, and binds permissions to routing names. A middleware can determine the permissions of all controllers. Developed based on Laravel 5.3, the only optimization is to bind permissions and routing aliases, so that the code can be used directly after it is written. However, the problem of too many configuration files has not been solved.
Any
is a project reconstructed based on iDashboard
experience. Permission control in previous versions required to be defined by yourself. Is there a way to automatically generate and judge permissions like ACL? This greatly reduces the need to define permissions and configurations. Any
was born.
The main principle of Any
is to obtain the currently accessed controller (controller) and method (method) based on the route visited by the user. The controller adds the method to generate a unique permission value. The middleware will judge when a user accesses a certain method. If you are a super administrator, even if you do not have this permission, the permission will be automatically given to the super administrator role. In order to avoid too many middleware queries, a copy of all the permissions of the current user will be cached after the user successfully logs in. When judging the permissions, they are directly obtained from the cache. Any update of the permissions of any role will update the cache. In addition, many optimizations have been made to the code.
These are just the beginning of the basic functions, hope to get more inspiration
Download the code of this project locally:
git clone https://github.com/lanceWan/any.git
Enter the project and install composer
:
cd any
composer install
Configuration .env
file:
[sudo]cp .env.example .env
Pay attention to execution permissions under Linux and Mac!
Configure the database:
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
Migrate data:
php artisan migrate --seed
OK, the project has been configured. Just visit the homepage and log in. If you don’t know the route, you can go directly to the routes/web.php
file. Default administrator account: iwanli
, password: 123456
. If you configure it under Linux
or Mac
, please pay attention to the permissions of the relevant directories. I won’t go into details here, enjoy!
The development of Any
is inseparable from everyone's feedback and suggestions. If you have any ideas, you can directly submit them at https://github.com/lanceWan/any/issues. Thank you.
Laravel learning exchange group: 312621686