interface AccountInterface

Defines an account interface which represents the current user.

Defines an object that has a user id, roles and can have session data. The interface is implemented both by the global session and the user entity.

Hierarchy

Expanded class hierarchy of AccountInterface

All classes that implement AccountInterface

30 files declare their use of AccountInterface
AccessibleInterface.php in drupal/core/lib/Drupal/Core/TypedData/AccessibleInterface.php
Contains \Drupal\Core\TypedData\AccessibleInterface.
AccessPluginBase.php in drupal/core/modules/views/lib/Drupal/views/Plugin/views/access/AccessPluginBase.php
Definition of Drupal\views\Plugin\views\access\AccessPluginBase.
BlockAccessController.php in drupal/core/modules/block/lib/Drupal/block/BlockAccessController.php
Contains \Drupal\block\BlockAccessController.
CategoryAccessController.php in drupal/core/modules/contact/lib/Drupal/contact/CategoryAccessController.php
Contains \Drupal\contact\CategoryAccessController.
CommentAccessController.php in drupal/core/modules/comment/lib/Drupal/comment/CommentAccessController.php
Contains \Drupal\comment\CommentAccessController

... See full list

File

drupal/core/lib/Drupal/Core/Session/AccountInterface.php, line 16
Contains \Drupal\Core\Session\AccountInterface.

Namespace

Drupal\Core\Session
View source
interface AccountInterface {

  /**
   * Returns the user ID or 0 for anonymous.
   *
   * @return int
   *   The user ID.
   */
  public function id();

  /**
   * Returns a list of roles.
   *
   * @return array
   *   List of role IDs.
   */
  public function getRoles();

  /**
   * Returns the session ID.
   *
   * @return string|NULL
   *   The session ID or NULL if this user does not have an active session.
   */
  public function getSessionId();

  /**
   * Returns the secure session ID.
   *
   * @return string|NULL
   *   The session ID or NULL if this user does not have an active secure session.
   */
  public function getSecureSessionId();

  /**
   * Returns the session data.
   *
   * @return array
   *   Array with the session data that belongs to this object.
   */
  public function getSessionData();

}

Members

Namesort descending Modifiers Type Description Overrides
AccountInterface::getRoles public function Returns a list of roles. 2
AccountInterface::getSecureSessionId public function Returns the secure session ID. 3
AccountInterface::getSessionData public function Returns the session data. 3
AccountInterface::getSessionId public function Returns the session ID. 3
AccountInterface::id public function Returns the user ID or 0 for anonymous. 1