定制 akawam/authenticate-as-anyone 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

akawam/authenticate-as-anyone

最新稳定版本:1.2.2

Composer 安装命令:

composer require akawam/authenticate-as-anyone

包简介

Package that allows you to authenticate as anyone, see readme for more informations

README 文档

README

The purpose of this package is to allow restricted users to imitate another user account.

It is usefull when you want to see what exactly is happening on a certain user account.

Installation

You can install the package via composer:

composer require akawam/authenticate-as-anyone

You can publish the view files with:

php artisan vendor:publish --provider="Akawam\AuthenticateAsAnyone\AuthenticateAsAnyoneServiceProvider" --tag="views"

You can publish the config file with:

php artisan vendor:publish --provider="Akawam\AuthenticateAsAnyone\AuthenticateAsAnyoneServiceProvider" --tag="config"

This is the contents of the published config file:

return [
    'route-prefix' => 'authenticate-as-anyone', //required
    'middlewares' =>
        [
            'auth', //optional
        ],
    'models' =>
        [
            //required name of the Model
            'User' =>
                [
                    'namespace' => 'App\Models',//optional (default is App\Models)
                    'columns' => [
                        'name' => 'name', //optional (default is name)
                        'firstname' => 'firstname', //optional (default is firstname)
                        'login' => 'email',//optional (default is email)
                    ],
                ],
        ],
];

Usage

  • Include the "logged as" ribbon
...
<body>
@aaaLogged

...
</body>
</html>

Adding your own event

When connecting as a user, an event is triggered (UserIsSwitching)

If you want to add some magic to your authentication (like adding some sessions data) you can do so by adding your own event listener like so :

// 'app/Providers/EventServiceProvider.php'
class EventServiceProvider extends ServiceProvider
{
    /**
     * The event listener mappings for the application.
     *
     * @var array
     */
    protected $listen = [
        UserIsSwitching::class => [
            TestListener::class
        ],
    ];

    /**
     * Register any events for your application.
     *
     * @return void
     */
    public function boot()
    {
        //
    }
}

Credits

License

The MIT License (MIT). Please see License File for more informations.

统计信息

  • 总下载量: 4.69k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-05