Mercurial > hg > isophonics-drupal-site
annotate core/lib/Drupal/Core/Session/AccountSwitcherInterface.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 |
Chris@0 | 3 namespace Drupal\Core\Session; |
Chris@0 | 4 |
Chris@0 | 5 /** |
Chris@0 | 6 * Defines an interface for a service for safe account switching. |
Chris@0 | 7 * |
Chris@0 | 8 * @ingroup user_api |
Chris@0 | 9 */ |
Chris@0 | 10 interface AccountSwitcherInterface { |
Chris@0 | 11 |
Chris@0 | 12 /** |
Chris@0 | 13 * Safely switches to another account. |
Chris@0 | 14 * |
Chris@0 | 15 * Each invocation of AccountSwitcherInterface::switchTo() must be |
Chris@0 | 16 * matched by a corresponding invocation of |
Chris@0 | 17 * AccountSwitcherInterface::switchBack() in the same function. |
Chris@0 | 18 * |
Chris@0 | 19 * @param \Drupal\Core\Session\AccountInterface $account |
Chris@0 | 20 * The account to switch to. |
Chris@0 | 21 * |
Chris@0 | 22 * @return \Drupal\Core\Session\AccountSwitcherInterface |
Chris@0 | 23 * $this. |
Chris@0 | 24 */ |
Chris@0 | 25 public function switchTo(AccountInterface $account); |
Chris@0 | 26 |
Chris@0 | 27 /** |
Chris@0 | 28 * Reverts to a previous account after switching. |
Chris@0 | 29 * |
Chris@0 | 30 * @return \Drupal\Core\Session\AccountSwitcherInterface |
Chris@0 | 31 * $this. |
Chris@0 | 32 * |
Chris@0 | 33 * @throws \RuntimeException |
Chris@0 | 34 * When there are no more account switches to revert. |
Chris@0 | 35 */ |
Chris@0 | 36 public function switchBack(); |
Chris@0 | 37 |
Chris@0 | 38 } |