You are here

interface AccountProxyInterface in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Session/AccountProxyInterface.php \Drupal\Core\Session\AccountProxyInterface

Defines an interface for a service which has the current account stored.

Hierarchy

Expanded class hierarchy of AccountProxyInterface

All classes that implement AccountProxyInterface

Related topics

6 files declare their use of AccountProxyInterface
AuthenticationSubscriber.php in core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php
Contains \Drupal\Core\EventSubscriber\AuthenticationSubscriber.
FormBuilderTest.php in core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
Contains \Drupal\Tests\Core\Form\FormBuilderTest.
LinkAccessConstraintValidator.php in core/modules/link/src/Plugin/Validation/Constraint/LinkAccessConstraintValidator.php
Contains \Drupal\link\Plugin\Validation\Constraint\LinkAccessConstraintValidator.
PrivateTempStore.php in core/modules/user/src/PrivateTempStore.php
Contains \Drupal\user\PrivateTempStore.
PrivateTempStoreFactory.php in core/modules/user/src/PrivateTempStoreFactory.php
Contains \Drupal\user\PrivateTempStoreFactory.

... See full list

File

core/lib/Drupal/Core/Session/AccountProxyInterface.php, line 15
Contains \Drupal\Core\Session\AccountProxyInterface.

Namespace

Drupal\Core\Session
View source
interface AccountProxyInterface extends AccountInterface {

  /**
   * Sets the currently wrapped account.
   *
   * Setting the current account is highly discouraged! Instead, make sure to
   * inject the desired user object into the dependent code directly.
   *
   * A preferable method of account impersonation is to use
   * \Drupal\Core\Session\AccountSwitcherInterface::switchTo() and
   * \Drupal\Core\Session\AccountSwitcherInterface::switchBack().
   *
   * @param \Drupal\Core\Session\AccountInterface $account
   *   The current account.
   */
  public function setAccount(AccountInterface $account);

  /**
   * Gets the currently wrapped account.
   *
   * @return \Drupal\Core\Session\AccountInterface
   *   The current account.
   */
  public function getAccount();

  /**
   * Sets the id of the initial account.
   *
   * Never use this method, its sole purpose is to work around weird effects
   * during mid-request container rebuilds.
   *
   * @param int $account_id
   *   The id of the initial account.
   */
  public function setInitialAccountId($account_id);

}

Members

Namesort descending Modifiers Type Description Overrides
AccountInterface::ANONYMOUS_ROLE constant Role ID for anonymous users.
AccountInterface::AUTHENTICATED_ROLE constant Role ID for authenticated users.
AccountInterface::getAccountName public function Returns the unaltered login name of this account. 3
AccountInterface::getDisplayName public function Returns the display name of this account. 3
AccountInterface::getEmail public function Returns the email address of this account. 3
AccountInterface::getLastAccessedTime public function The timestamp when the account last accessed the site. 3
AccountInterface::getPreferredAdminLangcode public function Returns the preferred administrative language code of the account. 3
AccountInterface::getPreferredLangcode public function Returns the preferred language code of the account. 3
AccountInterface::getRoles public function Returns a list of roles. 3
AccountInterface::getTimeZone public function Returns the timezone of this account. 3
AccountInterface::getUsername Deprecated public function Returns the unaltered login name of this account. 3
AccountInterface::hasPermission public function Checks whether a user has a certain permission. 3
AccountInterface::id public function Returns the user ID or 0 for anonymous. 2
AccountInterface::isAnonymous public function Returns TRUE if the account is anonymous. 3
AccountInterface::isAuthenticated public function Returns TRUE if the account is authenticated. 3
AccountProxyInterface::getAccount public function Gets the currently wrapped account. 1
AccountProxyInterface::setAccount public function Sets the currently wrapped account. 1
AccountProxyInterface::setInitialAccountId public function Sets the id of the initial account. 1