class AccountSwitcher

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

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.

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Session!AccountSwitcher.php/class/AccountSwitcher/8.1.x