mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 10:14:03 +00:00
Add notes about guards to the user impersonation page (#197)
* Add notes about guards to the user impersonation page * typo Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
This commit is contained in:
parent
aca5b15aba
commit
92b99647e2
1 changed files with 5 additions and 1 deletions
|
|
@ -6,7 +6,9 @@ section: content
|
||||||
|
|
||||||
# User impersonation {#user-impersonation}
|
# User impersonation {#user-impersonation}
|
||||||
|
|
||||||
This package comes with a feature that lets you impersonate users inside tenant databases. This feature works with **any identification method** and **any auth guard** — even if you use multiple.
|
This package comes with a feature that lets you impersonate users inside tenant databases. This feature works with **any identification method** and **any stateful auth guard** — even if you use multiple.
|
||||||
|
|
||||||
|
> Note: If you're currently using a non-stateful auth guard (e.g., Laravel Sanctum's guard), you can still utilize user impersonation by passing a stateful guard to `tenancy()->impersonate()` (e.g. the `'web'` guard).
|
||||||
|
|
||||||
## How it works
|
## How it works
|
||||||
|
|
||||||
|
|
@ -100,6 +102,8 @@ And that's it. The user will be redirected to your impersonation route, logged i
|
||||||
|
|
||||||
### Custom auth guards {#custom-auth-guards}
|
### Custom auth guards {#custom-auth-guards}
|
||||||
|
|
||||||
|
> Note: The auth guard used by user impersonation has to be stateful (it has to implement the `Illuminate\Contracts\Auth\StatefulGuard` interface).
|
||||||
|
|
||||||
If you're using multiple auth guards, you may want to specify what auth guard the impersonation logic should use.
|
If you're using multiple auth guards, you may want to specify what auth guard the impersonation logic should use.
|
||||||
|
|
||||||
To do this, simply pass the auth guard name as the fourth argument to the `impersonate()` method. So to expand on our example above:
|
To do this, simply pass the auth guard name as the fourth argument to the `impersonate()` method. So to expand on our example above:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue