$appUsers->impersonate()
Become any existing user or disable the current user
$appUsers->impersonate(string|null $who = null, Closure|null $callback = null): mixed
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| $who | stringornull |
null
|
User ID or email address, null to use the actual user again, 'kirby' for a virtual admin user or 'nobody' to disable the actual user |
| $callback | Closureornull |
null
|
Optional action function that will be run with the permissions of the impersonated user; the impersonation will be reset afterwards |
Return type
mixed
If called without callback: User that was impersonated; if called with callback: Return value from the callback
Exceptions
| Type | Description |
|---|---|
Throwable |
Parent class
Kirby\Cms\AppUsers