An implementation of AccountSwitcherInterface.
This allows for safe switching of user accounts by ensuring that session data for one user is not leaked in to others. It also provides a stack that allows reverting to a previous user after switching.
Hierarchy
- class \Drupal\Core\Session\AccountSwitcher implements AccountSwitcherInterface
File
- core/lib/Drupal/Core/Session/AccountSwitcher.php, line 12
Namespace
Drupal\Core\Session
Members
Name | Modifiers | Type | Description |
---|---|---|---|
AccountSwitcher::$accountStack | protected | property | A stack of previous overridden accounts. |
AccountSwitcher::$currentUser | protected | property | The current user service. |
AccountSwitcher::$originalSessionSaving | protected | property | The original state of session saving prior to account switching. |
AccountSwitcher::$writeSafeHandler | protected | property | The write-safe session handler. |
AccountSwitcher::switchBack | public | function | Reverts to a previous account after switching. Overrides AccountSwitcherInterface::switchBack |
AccountSwitcher::switchTo | public | function | Safely switches to another account. Overrides AccountSwitcherInterface::switchTo |
AccountSwitcher::__construct | public | function | Constructs a new AccountSwitcher. |
Please login to continue.