404labfr / 404labfr/laravel-impersonate

Custom App SessionGuard breaks this plugin

Đang mở
#84 2 bình luận 1 reaction 0 người được giao Xem trên GitHub
help wanted
Ngôn ngữ chính
PHP
Star
2.3k
Fork
235
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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!

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.