stechstudio / filament-impersonate Goto Github PK
View Code? Open in Web Editor NEWFilament plugin that makes it easy to impersonate your users
Filament plugin that makes it easy to impersonate your users
using this package with two guards "web" (those my website users) and "admins" (filament users)
and added this package to both.
the problem is when impersonating "web", it works well.
but when trying to impersonate "admins" guard, it just picks the same id in guard "web"
lost? me too 😂.
so in admins table
and in users table
when i click impersonate on admin2, it impersonate user2 instead.
auth.php
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'clients',
],
'admins' => [
'driver' => 'session',
'provider' => 'admins',
],
],
When adding the impersonate Action to a Group like so:
->actions([
ActionGroup::make([
ViewAction::make(),
EditAction::make(),
DeleteAction::make(),
Impersonate::make()->redirectTo('/admin'),
]),
]);
the styling isn't the same, nor does the label appear:
Is this caused by my incorrect usage of the plugin or is it a bug?
Hi, could you bump the version to support Laravel 10?
When redirect I'm getting this error:
Filament\FilamentManager::getUserName(): Argument #1 ($user) must be of type Illuminate\Database\Eloquent\Model|Illuminate\Contracts\Auth\Authenticatable, null given, called in /Users/daniel/Desktop/Proyectos/tickify/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 353
<x-filament-impersonate::banner/>
I have an issue to display the banner . I have investigated the code. I found that the issue lies in the following file:
In the original code snippet, the Filament::registerRenderHook method is used as follows:
Filament::registerRenderHook(
'body.start',
static fn (): string => Blade::render("<x-filament-impersonate::banner/>")
);
To resolve the issue, you can change it to the following code:
FilamentView::registerRenderHook(
'panels::body.start',
static fn (): string => Blade::render("<x-filament-impersonate::banner/>")
);
If you're okay with it, I can create a pull request to implement the changes.
Let me know what you think.
By the way, thank you for your plugin
div.fi-layout > aside.fi-sidebar {
padding-{{ $position }}: var(--impersonate-banner-height);
}
This line of code cause an issues with the filament sidebar, it create a gap between the sidebar and the impersonate banner.
I'm using the default setup/configuration of the plugin.
Disabling the Css it fixed the issue or if the position
setting is top
then the css will not be applied.
Hello, I'm a new Filament user so please excuse me if this is actually entirely my fault!
I've followed the steps to install the package and it works great, except that when I click on the "Leave" button on the banner, the app crashes with the following error.
Symfony\Component\HttpFoundation\Response::setContent(): Argument #1 ($content) must be of type ?string, Illuminate\Routing\Redirector given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Response.php on line 72
I tried setting a different redirect with the backTo()
method, and through the .env
file but neither worked.
Any idea why this might be happening?
Thanks!
Clicking on the impersonate button/icon cause a RouteNotFoundException "Route [filament.auth.login] not defined" in routes/web.php
I attempted to impersonate a soft-deleted user, which ends up trapping me in the following exception:
Filament\FilamentManager::getUserName(): Argument #1 ($user) must be of type Illuminate\Database\Eloquent\Model|Illuminate\Contracts\Auth\Authenticatable, null given
in reference to
<x-filament-impersonate::banner/>
I understand why this is probably happening; the intended $user is not being hydrated ->withTrashed()
applied. Where exactly do I go to customize the banner, given that in the current version, it is being injected via a render hook? i.e., I did not place x-impersonate::banner
into my master layout.
Temporary solution to break out of the exception was to set FILAMENT_IMPERSONATE_BANNER_RENDER_HOOK=""
in .env so that I could log back in.
I have a resource named InstructorResource
. The Instructor
model has a relational user
method which belongs to User
model.
I am trying to impersonate from InstructorResource by:
return $table
->actions([
Impersonate::make()
->redirectTo('/instructor'),
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
]),
From the UserResource
class, it is working perfectly though. Is it possible to impersonate from InstructResource
?
I am unable to get this plugin to work in Filament Admin Panel v2.
Would love to get a hint on how to proceed.
During composer update to 3.6 this error
Filament\Support\Facades\FilamentView::registerRenderHook(): Argument #1 ($name) must be of type string, null given, called in /app/vendor/stechstudio/filament-impersonate/src/FilamentImpersonateServiceProvider.php on line 40
Is it possible to add Laravel 9 support?
lab404/laravel-impersonate
needs to be bumped up?
Thank you!
Hello,
If you have a table in which there are widgets that interact with the table(InteractsWithPageTable
) when executing the impersonate action another widget event is sent, which causes that the user is not redirected correctly.
Do you know any way to stop this from happening?
Best regards
Get this error message when I try to impersonate a user.
Call to undefined method Filament\FilamentManager::getCurrentPanel()
- Using jetstream. Livewire 2 - any idea?
In the doc it says use IsFilamentUser
, but I get the message Undefined type 'App\Models\IsFilamentUser'.
and it can't find anything to import. It seems to work without IsFilamentUser
, but am I doing anything wrong or is the example wrong?
class User implements FilamentUser {
use IsFilamentUser;
public function canImpersonate()
{
return true;
}
}
It seems that this plugin isn't working properly with Laravel Octane (https://laravel.com/docs/10.x/octane).
I have an existing project where I use your plugin since you released it. Now we switched to laravel Octane (with roadrunner) on Production, and a user still can impersonate, but the top bar to end the Impersonate isn't displayed.
I can reproduce this on local system as well. I login+impersonate:
php artisan serve
everything works as expected.php artisan octane:start
every thing works, except I cant see the impersonate bar.Any ideas? Does this package use any static class properties or something? See https://laravel.com/docs/10.x/octane#dependency-injection-and-octane
Btw: Thanks for your great package!
Impersonate stopped working after I updated Laravel. I was on Laravel 9.3.1 and it worked and after updating to 9.6.0 I just get logged out when I click on the impersonate button. Any ideas why? Impersonate, Filament and Jetstream are all on latest versions.
I found two things that seems to "fix" this. One is removing this line from App\Http\Kernel.php
... \Laravel\Jetstream\Http\Middleware\AuthenticateSession::class,
and the other is changing Route::middleware(['auth:sanctum', 'verified'])
to Route::middleware(['auth:web', 'verified'])
in my routes file. Does anyone know the implications of doing any of those options?
Thank you!
I have a navbar on the page that is fixed to the top. When impersonating someone, the impersonate::banner is also fixed to the top and behind the navbar. How can I make it appear below my navbar?
I tried assigning a style of top: 60px;
, but that didn't work.
Thanks!
Hi,
In the latest update, when i run php artisan route:cache I will get this exception:
Cannot declare class STS\FilamentImpersonate\Impersonate, because the name is already in use when caching route
Hi there,
I noticed this package isn't visible in the Filament plugins directory? You can submit it here: https://github.com/filamentphp/filamentphp.com/blob/main/README.md#contributing
Right now this is only available as a table action. Would be nice to be available as a page action as well, so it could be added to a View User page, for example.
I'm on Laravel 11
When I click Leave
in the banner, nothing happens.
I've narrowed it down to the ImpersonateManager
leave
method not working.
Which as to do with the package this package uses.
Hi,
Many thanks for this package. It would be great if the banner style automatically switches when filament dark mode is enabled and toggled.
Currently, package can't be installed on Laravel 11.
In banner component, if auto is set, it only appears light mode.
$flipped variable is not set anywhere.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.