saibal-roy / laravel-iam
为 Laravel 框架提供优雅的身份访问管理方式
1.0.6
2020-06-09 13:35 UTC
Requires
- php: ^7.1.3
- ext-json: *
- laravel/framework: ^5.6|^6.0|^7.0
- laravelcollective/html: ~5.6.0|~5.7.0|~5.8.0|^6.0
- spatie/laravel-permission: ^2.37|^3.0
README
为 Laravel 框架提供优雅的身份访问管理方式。在以下方面考虑了以下要点
- 如果您想拥有一个独立身份访问管理仪表板。
- 您的现有应用程序用户表将不受影响。
- 通过配置文件进行自定义配置。
- 使用 spatie 权限包设置角色和权限。感谢他们的出色工作。
功能
- 支持从 5.6 版本的 Laravel 开始。
- 独立的身份访问管理仪表板
- 管理用户
- 管理角色
- 管理权限
- 模拟用户登录
安装
通过 Composer
composer require saibal-roy/laravel-iam
创建认证脚手架:对于 Laravel 版本 < 5.8
php artisan make:auth
对于 Laravel 版本 6.x
composer require laravel/ui "^1.0" --dev
php artisan ui bootstrap --auth
对于 Laravel 版本 7.x
composer require laravel/ui php artisan ui bootstrap --auth
请确保在继续之前,Laravel 认证脚手架已完成。
Artisan
php artisan migrate php artisan laravel-iam:setup-root # to setup the root user php artisan laravel-iam:publish --force # for each new package update for all publishable contents
默认凭证和仪表板
Username : sudo@email.com Password : secret User : {domain}/iam or localhost:8000/iam (locally)
用法
Artisan 命令
# for each new package update for all publishable contents php artisan laravel-iam:publish --force # can also use it to reset the root user credentials php artisan laravel-iam:setup-root
高级用法
可由 .env 修改的配置常量
# /* # |-------------------------------------------------------------------------- # | LaravelIAM Identity configurations # |-------------------------------------------------------------------------- # | # | This configuration options determines the identity table that will # | be used to store Laravel IAM's data. In addition, # | you may set any custom options as needed. # | # */ 'identity_table' => env('LARAVELIAM_TABLE', 'users'), 'identity_pk' => env('LARAVELIAM_TBL_PK_COLUMN', 'email'), 'identity_name' => env('LARAVELIAM_TBL_NAME_COLUMN', 'name'), 'identity_password' => env('LARAVELIAM_TBL_PWD_COLUMN', 'password'), # /* # |-------------------------------------------------------------------------- # | LaravelIAM Root User values # |-------------------------------------------------------------------------- # | # | This configuration options determines the root user credentials. In addition, # | you may set any custom options as needed. # | # */ 'sudo_user_name' => 'sudo', 'sudo_user_pk' => 'sudo@email.com', 'sudo_password' => 'secret'
获取 LaravelIam 用户包装器以访问 spatie 包的所有角色和权限。
app('laraveliam')->identity()
检查当前用户是否有权限查看 LaravelIam 仪表板。
app('laraveliam')->iam()
变更日志
有关最近更改的更多信息,请参阅变更日志。
安全
如果您发现任何安全相关的问题,请通过电子邮件 connectsaibalroy@gmail.com 而不是使用问题跟踪器。
许可证
MIT 许可证。有关更多信息,请参阅许可证文件。