Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KABBOUCHI authored Sep 15, 2021
1 parent 5a59073 commit c20e102
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/Http/Controllers/ImpersonateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ public function take(Request $request, $id, $guardName = null)
{
$guardName = $guardName ?? config('nova-impersonate.default_impersonator_guard');

if (method_exists($request->user(), 'canImpersonate')) {
abort(403);
}

$user_to_impersonate = $this->manager->findUserById($id, $guardName);

if (! $request->user()->canImpersonate($user_to_impersonate)) {
if (method_exists($request->user(), 'canImpersonate') && ! $request->user()->canImpersonate($user_to_impersonate)) {
abort(403);
}

Expand Down

0 comments on commit c20e102

Please sign in to comment.