404labfr / 404labfr/laravel-impersonate

Custom App SessionGuard breaks this plugin

オープン
#84 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る
help wanted
主要言語
PHP
スター
2.3k
フォーク
235
PR マージ指標
30日以内にマージされた PR はありません

説明

Hello,

I tried to use your plugin but I couldn't for the life of me figure out why it wouldn't work... both the impersonate.take and the impersonate.leave routes wouldn't do anything useful.

I've then dumped the `Session::all()` and noticed something was actually happening but I still wasn't logged in with the user i wanted to impersonate.

So I've dug deeper and reached your `ImpersonateManager` class. Your functions `take` and `leave` are wrapped in `try {} catch {}` so i just removed the wrapper and got exceptions that `quietLogin` and `quietLogout` didn't exist in my app `SessionGuard`.

That's when I've figured it out that your manager was using my custom SessionGuard instead of your own `\Lab404\Impersonate\Guard\SessionGuard`. Having my own SessionGuard class extend yours instead of the base class fixed this issue right away.

... HOWEVER ...

Why on earth did you put the try catch wrapper and then DISCARD all possible errors / exceptions thrown? I'm talking about [this](https://github.com/404labfr/laravel-impersonate/blob/master/src/Services/ImpersonateManager.php#L120) and [this](https://github.com/404labfr/laravel-impersonate/blob/master/src/Services/ImpersonateManager.php#L146)

Also please specify in the readme that your plugin needs to use your own SessionGuard. Using a custom SessionGuard instead of your own will never work and unfortunately it will never throw any errors 😞

The solution of course is to have the custom SessionGuard extend your SessionGuard which includes the `quiet` functions...

There has to be a better way of doing this...
Thanks!

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。