lwj / laravel-rbac
基于权限
Requires
- php: >=7.1.0
- tymon/jwt-auth: 1.*
- dev-master / 1.0.x-dev
- 0.1.2
- 0.1.1
- 0.1
- dev-dependabot/npm_and_yarn/json5-1.0.2
- dev-dependabot/npm_and_yarn/express-4.18.2
- dev-dependabot/npm_and_yarn/qs-and-express-6.11.0
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/loader-utils-and-webpack-cli-1.4.2
- dev-dependabot/npm_and_yarn/eventsource-1.1.1
- dev-dependabot/npm_and_yarn/async-2.6.4
- dev-dependabot/npm_and_yarn/url-parse-1.5.10
- dev-dependabot/npm_and_yarn/ajv-6.12.6
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/ws-6.2.2
- dev-dependabot/npm_and_yarn/dns-packet-1.3.4
- dev-dependabot/npm_and_yarn/browserslist-4.16.6
- dev-dependabot/npm_and_yarn/lodash-4.17.21
- dev-dependabot/npm_and_yarn/ssri-6.0.2
- dev-dependabot/npm_and_yarn/y18n-4.0.1
- dev-dependabot/npm_and_yarn/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/axios-0.21.1
- dev-dependabot/npm_and_yarn/ini-1.3.8
- dev-dependabot/npm_and_yarn/http-proxy-1.18.1
- dev-dependabot/npm_and_yarn/websocket-extensions-0.1.4
- dev-dependabot/npm_and_yarn/acorn-6.4.1
This package is auto-updated.
Last update: 2024-11-05 05:08:45 UTC
README
#基于数据的RBAC
适用于前后端分离项目的权限管理
树形菜单 角色管理 用户管理 API管理
Install
Require this package with composer using the following command:
composer require lwj/laravel-rbac
After updating composer, add the service provider to the providers
array in config/app.php
Lwj\Rbac\ServiceProvider::class,
Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
Add the middleware alias routeMiddleware
array in app/Http/Kernel.php
'jwt.auth' => \Tymon\JWTAuth\Http\Middleware\Authenticate::class, 'jwt.refresh' => \Tymon\JWTAuth\Http\Middleware\RefreshToken::class,
Generate the ENV option:
php artisan jwt:secret
Config
You can also publish the config file to change implementations (ie. interface to specific class) or set defaults for --helpers
or --sublime
.
php artisan vendor:publish --provider="Lwj\Rbac\ServiceProvider" --tag=config php artisan vendor:publish --provider="Lwj\Rbac\ServiceProvider" --tag=assets php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
Inside the config/auth.php file you will need to make a few changes to configure Laravel to use the jwt guard to power your application authentication.
Make the following changes to the file 'config/auth':
use Lwj\Rbac\Models\User;
And change the array:
'defaults' => [ 'guard' => 'api', 'passwords' => 'users', ], ... 'guards' => [ ..., 'api' => [ 'driver' => 'token', 'provider' => 'users', ], 'rbac' => [ 'driver' => 'jwt', 'provider' => 'users', ] ], ... 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => User::class, ], ],
Migration
You can also migrate tables and base data:
php artisan migrate
User
Default User:
name: admin@liweijia.com password: 123456
'SUPER_ADMIN' env option to set super admin in this system: if you want to add new super admin,you can use '|' separator
eg:SUPER_ADMIN=admin@liweijia.com|test@liweijia.com
进入docker之后 ln -sf /var/www/html/pay-php/service2/packages/laravel-rbac/public /var/www/html/pay-php/service2/public/vendor/rbac