You are here

class TokenAuthUser in Simple OAuth (OAuth2) & OpenID Connect 5.x

Same name and namespace in other branches
  1. 8.4 src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser
  2. 8 src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser
  3. 8.2 src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser
  4. 8.3 src/Authentication/TokenAuthUser.php \Drupal\simple_oauth\Authentication\TokenAuthUser

The decorated user class with token information.

@internal

Hierarchy

Expanded class hierarchy of TokenAuthUser

3 files declare their use of TokenAuthUser
Jwks.php in src/Controller/Jwks.php
SimpleOauthAuthenticationProvider.php in src/Authentication/Provider/SimpleOauthAuthenticationProvider.php
UserInfo.php in src/Controller/UserInfo.php

File

src/Authentication/TokenAuthUser.php, line 18

Namespace

Drupal\simple_oauth\Authentication
View source
class TokenAuthUser implements TokenAuthUserInterface {

  /**
   * The decorator subject.
   *
   * @var \Drupal\user\UserInterface
   */
  protected $subject;

  /**
   * The bearer token.
   *
   * @var \Drupal\simple_oauth\Entity\Oauth2TokenInterface
   */
  protected $token;

  /**
   * The activated consumer instance.
   *
   * @var \Drupal\consumers\Entity\Consumer
   */
  protected $consumer;

  /**
   * Constructs a TokenAuthUser object.
   *
   * @param \Drupal\simple_oauth\Entity\Oauth2TokenInterface $token
   *   The underlying token.
   *
   * @throws \League\OAuth2\Server\Exception\OAuthServerException
   *   When there is no user.
   */
  public function __construct(Oauth2TokenInterface $token) {
    $this->consumer = $token
      ->get('client')->entity;
    if (!($this->subject = $token
      ->get('auth_user_id')->entity)) {
      $this->subject = $this->consumer
        ->get('user_id')->entity;
    }
    if (!$this->subject) {
      $server_request = \Drupal::service('psr7.http_message_factory')
        ->createRequest(\Drupal::request());
      throw OAuthServerException::invalidClient($server_request);
    }
    $this->token = $token;
  }

  /**
   * {@inheritdoc}
   */
  public function getToken() {
    return $this->token;
  }

  /**
   * {@inheritdoc}
   */
  public function getConsumer() {
    return $this->consumer;
  }

  /**
   * {@inheritdoc}
   */
  public function getRoles($exclude_locked_roles = FALSE) {
    return array_map(function ($item) {
      return $item['target_id'];
    }, $this->token
      ->get('scopes')
      ->getValue());
  }

  /**
   * {@inheritdoc}
   */
  public function hasPermission($permission) {

    // User #1 has all privileges.
    if ((int) $this
      ->id() === 1) {
      return TRUE;
    }
    return $this
      ->getRoleStorage()
      ->isPermissionInRoles($permission, $this
      ->getRoles());
  }

  /**
   * Returns the role storage object.
   *
   * @return \Drupal\user\RoleStorageInterface
   *   The role storage object.
   *
   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
   */
  protected function getRoleStorage() {

    /** @var \Drupal\user\RoleStorageInterface $storage */
    $storage = \Drupal::entityTypeManager()
      ->getStorage('user_role');
    return $storage;
  }

  /* ---------------------------------------------------------------------------
    All the methods below are delegated to the decorated user.
    --------------------------------------------------------------------------- */

  /**
   * {@inheritdoc}
   */
  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
    return $this->subject
      ->access($operation, $account, $return_as_object);
  }

  /**
   * {@inheritdoc}
   */
  public function isAuthenticated() {
    return $this->subject
      ->isAuthenticated();
  }

  /**
   * {@inheritdoc}
   */
  public function isAnonymous() {
    return $this->subject
      ->isAnonymous();
  }

  /**
   * {@inheritdoc}
   */
  public function getPreferredLangcode($fallback_to_default = TRUE) {
    return $this->subject
      ->getPreferredLangcode($fallback_to_default);
  }

  /**
   * {@inheritdoc}
   */
  public function getPreferredAdminLangcode($fallback_to_default = TRUE) {
    return $this->subject
      ->getPreferredAdminLangcode($fallback_to_default);
  }

  /**
   * {@inheritdoc}
   */
  public function getUsername() {
    return $this->subject
      ->getUsername();
  }

  /**
   * {@inheritdoc}
   */
  public function getAccountName() {
    return $this->subject
      ->getAccountName();
  }

  /**
   * {@inheritdoc}
   */
  public function getDisplayName() {
    return $this->subject
      ->getDisplayName();
  }

  /**
   * {@inheritdoc}
   */
  public function getEmail() {
    return $this->subject
      ->getEmail();
  }

  /**
   * {@inheritdoc}
   */
  public function getTimeZone() {
    return $this->subject
      ->getTimeZone();
  }

  /**
   * {@inheritdoc}
   */
  public function getLastAccessedTime() {
    return $this->subject
      ->getLastAccessedTime();
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheContexts() {
    return $this->subject
      ->getCacheContexts();
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheTags() {
    return $this->subject
      ->getCacheTags();
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheMaxAge() {
    return $this->subject
      ->getCacheMaxAge();
  }

  /**
   * {@inheritdoc}
   */
  public function hasTranslationChanges() {
    return $this->subject
      ->hasTranslationChanges();
  }

  /**
   * {@inheritdoc}
   */
  public function setRevisionTranslationAffected($affected) {
    return $this->subject
      ->setRevisionTranslationAffected($affected);
  }

  /**
   * {@inheritdoc}
   */
  public function isRevisionTranslationAffected() {
    return $this->subject
      ->isRevisionTranslationAffected();
  }

  /**
   * {@inheritdoc}
   */
  public function getChangedTime() {
    return $this->subject
      ->getChangedTime();
  }

  /**
   * {@inheritdoc}
   */
  public function setChangedTime($timestamp) {
    return $this->subject
      ->setChangedTime($timestamp);
  }

  /**
   * {@inheritdoc}
   */
  public function getChangedTimeAcrossTranslations() {
    return $this->subject
      ->getChangedTimeAcrossTranslations();
  }

  /**
   * {@inheritdoc}
   */
  public function uuid() {
    return $this->subject
      ->uuid();
  }

  /**
   * {@inheritdoc}
   */
  public function id() {
    return $this->subject
      ->id();
  }

  /**
   * {@inheritdoc}
   */
  public function language() {
    return $this->subject
      ->language();
  }

  /**
   * {@inheritdoc}
   */
  public function isNew() {
    return $this->subject
      ->isNew();
  }

  /**
   * {@inheritdoc}
   */
  public function enforceIsNew($value = TRUE) {
    return $this->subject
      ->enforceIsNew($value);
  }

  /**
   * {@inheritdoc}
   */
  public function getEntityTypeId() {
    return $this->subject
      ->getEntityTypeId();
  }

  /**
   * {@inheritdoc}
   */
  public function bundle() {
    return $this->subject
      ->bundle();
  }

  /**
   * {@inheritdoc}
   */
  public function label() {
    return $this->subject
      ->label();
  }

  /**
   * {@inheritdoc}
   */
  public function urlInfo($rel = 'canonical', array $options = []) {
    return $this->subject
      ->urlInfo($rel, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function url($rel = 'canonical', $options = []) {
    return $this->subject
      ->url($rel, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function link($text = NULL, $rel = 'canonical', array $options = []) {
    return $this->subject
      ->link($text, $rel, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function hasLinkTemplate($key) {
    return $this->subject
      ->hasLinkTemplate($key);
  }

  /**
   * {@inheritdoc}
   */
  public function uriRelationships() {
    return $this->subject
      ->uriRelationships();
  }

  /**
   * {@inheritdoc}
   */
  public static function load($id) {
    return User::load($id);
  }

  /**
   * {@inheritdoc}
   */
  public static function loadMultiple(array $ids = NULL) {
    return User::loadMultiple($ids);
  }

  /**
   * {@inheritdoc}
   */
  public static function create(array $values = []) {
    return User::create($values);
  }

  /**
   * {@inheritdoc}
   */
  public function save() {
    return $this->subject
      ->save();
  }

  /**
   * {@inheritdoc}
   */
  public function delete() {
    $this->subject
      ->delete();
  }

  /**
   * {@inheritdoc}
   */
  public function preSave(EntityStorageInterface $storage) {
    $this->subject
      ->preSave($storage);
  }

  /**
   * {@inheritdoc}
   */
  public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    $this->subject
      ->postSave($storage, $update);
  }

  /**
   * {@inheritdoc}
   */
  public static function preCreate(EntityStorageInterface $storage, array &$values) {
    User::preCreate($storage, $values);
  }

  /**
   * {@inheritdoc}
   */
  public function postCreate(EntityStorageInterface $storage) {
    return $this->subject
      ->postCreate($storage);
  }

  /**
   * {@inheritdoc}
   */
  public static function preDelete(EntityStorageInterface $storage, array $entities) {
    User::preDelete($storage, $entities);
  }

  /**
   * {@inheritdoc}
   */
  public static function postDelete(EntityStorageInterface $storage, array $entities) {
    User::postDelete($storage, $entities);
  }

  /**
   * {@inheritdoc}
   */
  public static function postLoad(EntityStorageInterface $storage, array &$entities) {
    User::postLoad($storage, $entities);
  }

  /**
   * {@inheritdoc}
   */
  public function createDuplicate() {
    return $this->subject
      ->createDuplicate();
  }

  /**
   * {@inheritdoc}
   */
  public function getEntityType() {
    return $this->subject
      ->getEntityType();
  }

  /**
   * {@inheritdoc}
   */
  public function referencedEntities() {
    return $this->subject
      ->referencedEntities();
  }

  /**
   * {@inheritdoc}
   */
  public function getOriginalId() {
    return $this->subject
      ->getOriginalId();
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheTagsToInvalidate() {
    return $this->subject
      ->getCacheTagsToInvalidate();
  }

  /**
   * {@inheritdoc}
   */
  public function setOriginalId($id) {
    return $this->subject
      ->setOriginalId($id);
  }

  /**
   * {@inheritdoc}
   */
  public function getTypedData() {
    return $this->subject
      ->getTypedData();
  }

  /**
   * {@inheritdoc}
   */
  public function getConfigDependencyKey() {
    return $this->subject
      ->getConfigDependencyKey();
  }

  /**
   * {@inheritdoc}
   */
  public function getConfigDependencyName() {
    return $this->subject
      ->getConfigDependencyName();
  }

  /**
   * {@inheritdoc}
   */
  public function getConfigTarget() {
    return $this->subject
      ->getConfigTarget();
  }

  /**
   * {@inheritdoc}
   */
  public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    return User::baseFieldDefinitions($entity_type);
  }

  /**
   * {@inheritdoc}
   */
  public static function bundleFieldDefinitions(EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) {
    return User::bundleFieldDefinitions($entity_type, $bundle, $base_field_definitions);
  }

  /**
   * {@inheritdoc}
   */
  public function hasField($field_name) {
    return $this->subject
      ->hasField($field_name);
  }

  /**
   * {@inheritdoc}
   */
  public function getFieldDefinition($name) {
    return $this->subject
      ->getFieldDefinition($name);
  }

  /**
   * {@inheritdoc}
   */
  public function getFieldDefinitions() {
    return $this->subject
      ->getFieldDefinitions();
  }

  /**
   * {@inheritdoc}
   */
  public function toArray() {
    return $this->subject
      ->toArray();
  }

  /**
   * {@inheritdoc}
   */
  public function get($field_name) {
    return $this->subject
      ->get($field_name);
  }

  /**
   * {@inheritdoc}
   */
  public function set($field_name, $value, $notify = TRUE) {
    return $this->subject
      ->set($field_name, $value, $notify);
  }

  /**
   * {@inheritdoc}
   */
  public function getFields($include_computed = TRUE) {
    return $this->subject
      ->getFields($include_computed);
  }

  /**
   * {@inheritdoc}
   */
  public function getTranslatableFields($include_computed = TRUE) {
    return $this->subject
      ->getTranslatableFields($include_computed);
  }

  /**
   * {@inheritdoc}
   */
  public function onChange($field_name) {
    $this->subject
      ->onChange($field_name);
  }

  /**
   * {@inheritdoc}
   */
  public function validate() {
    return $this->subject
      ->validate();
  }

  /**
   * {@inheritdoc}
   */
  public function isValidationRequired() {
    return $this->subject
      ->isValidationRequired();
  }

  /**
   * {@inheritdoc}
   */
  public function setValidationRequired($required) {
    return $this->subject
      ->setValidationRequired($required);
  }

  /**
   * {@inheritdoc}
   */
  public function addCacheContexts(array $cache_contexts) {
    return $this->subject
      ->addCacheContexts($cache_contexts);
  }

  /**
   * {@inheritdoc}
   */
  public function addCacheTags(array $cache_tags) {
    return $this->subject
      ->addCacheTags($cache_tags);
  }

  /**
   * {@inheritdoc}
   */
  public function mergeCacheMaxAge($max_age) {
    return $this->subject
      ->mergeCacheMaxAge($max_age);
  }

  /**
   * {@inheritdoc}
   */
  public function addCacheableDependency($other_object) {
    return $this->subject
      ->addCacheableDependency($other_object);
  }

  /**
   * {@inheritdoc}
   */
  public function isNewRevision() {
    return $this->subject
      ->isNewRevision();
  }

  /**
   * {@inheritdoc}
   */
  public function setNewRevision($value = TRUE) {
    $this->subject
      ->setNewRevision($value);
  }

  /**
   * {@inheritdoc}
   */
  public function getRevisionId() {
    return $this->subject
      ->getRevisionId();
  }

  /**
   * {@inheritdoc}
   */
  public function isDefaultRevision($new_value = NULL) {
    return $this->subject
      ->isDefaultRevision($new_value);
  }

  /**
   * {@inheritdoc}
   */
  public function preSaveRevision(EntityStorageInterface $storage, \stdClass $record) {
    $this->subject
      ->preSaveRevision($storage, $record);
  }

  /**
   * {@inheritdoc}
   */
  public function isDefaultTranslation() {
    return $this->subject
      ->isDefaultTranslation();
  }

  /**
   * {@inheritdoc}
   */
  public function getTranslationLanguages($include_default = TRUE) {
    return $this->subject
      ->getTranslationLanguages($include_default);
  }

  /**
   * {@inheritdoc}
   */
  public function getTranslation($langcode) {
    return $this->subject
      ->getTranslation($langcode);
  }

  /**
   * {@inheritdoc}
   */
  public function getUntranslated() {
    return $this->subject
      ->getUntranslated();
  }

  /**
   * {@inheritdoc}
   */
  public function hasTranslation($langcode) {
    return $this->subject
      ->hasTranslation($langcode);
  }

  /**
   * {@inheritdoc}
   */
  public function addTranslation($langcode, array $values = []) {
    return $this->subject
      ->addTranslation($langcode, $values);
  }

  /**
   * {@inheritdoc}
   */
  public function removeTranslation($langcode) {
    $this->subject
      ->removeTranslation($langcode);
  }

  /**
   * {@inheritdoc}
   */
  public function isTranslatable() {
    return $this->subject
      ->isTranslatable();
  }

  /**
   * {@inheritdoc}
   */
  public function hasRole($rid) {
    return in_array($rid, $this
      ->getRoles());
  }

  /**
   * {@inheritdoc}
   */
  public function addRole($rid) {
    $this->subject
      ->addRole($rid);
  }

  /**
   * {@inheritdoc}
   */
  public function removeRole($rid) {
    $this->subject
      ->removeRole($rid);
  }

  /**
   * {@inheritdoc}
   */
  public function setUsername($username) {
    return $this->subject
      ->setUsername($username);
  }

  /**
   * {@inheritdoc}
   */
  public function getPassword() {
    return $this->subject
      ->getPassword();
  }

  /**
   * {@inheritdoc}
   */
  public function setPassword($password) {
    return $this->subject
      ->setPassword($password);
  }

  /**
   * {@inheritdoc}
   */
  public function setEmail($mail) {
    return $this->subject
      ->setEmail($mail);
  }

  /**
   * {@inheritdoc}
   */
  public function getCreatedTime() {
    return $this->subject
      ->getCreatedTime();
  }

  /**
   * {@inheritdoc}
   */
  public function setLastAccessTime($timestamp) {
    return $this->subject
      ->setLastAccessTime($timestamp);
  }

  /**
   * {@inheritdoc}
   */
  public function getLastLoginTime() {
    return $this->subject
      ->getLastLoginTime();
  }

  /**
   * {@inheritdoc}
   */
  public function setLastLoginTime($timestamp) {
    return $this->subject
      ->setLastLoginTime($timestamp);
  }

  /**
   * {@inheritdoc}
   */
  public function isActive() {
    return $this->subject
      ->isActive();
  }

  /**
   * {@inheritdoc}
   */
  public function isBlocked() {
    return $this->subject
      ->isBlocked();
  }

  /**
   * {@inheritdoc}
   */
  public function activate() {
    return $this->subject
      ->activate();
  }

  /**
   * {@inheritdoc}
   */
  public function block() {
    return $this->subject
      ->block();
  }

  /**
   * {@inheritdoc}
   */
  public function getInitialEmail() {
    return $this->subject
      ->getInitialEmail();
  }

  /**
   * {@inheritdoc}
   */
  public function setExistingPassword($password) {
    return $this->subject
      ->setExistingPassword($password);
  }

  /**
   * {@inheritdoc}
   */
  public function checkExistingPassword(UserInterface $account_unchanged) {
    return $this->subject
      ->checkExistingPassword($account_unchanged);
  }

  /**
   * {@inheritdoc}
   */
  public function getIterator() {
    throw new \Exception('Invalid use of getIterator in token authentication.');
  }

  /**
   * {@inheritdoc}
   */
  public function toUrl($rel = 'canonical', array $options = []) {
    return $this->subject
      ->toUrl($rel, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function toLink($text = NULL, $rel = 'canonical', array $options = []) {
    return $this->subject
      ->toLink($text, $rel, $options);
  }

  /**
   * {@inheritdoc}
   */
  public function isNewTranslation() {
    return $this->subject
      ->isNewTranslation();
  }

  /**
   * {@inheritdoc}
   */
  public function getLoadedRevisionId() {
    return $this->subject
      ->getLoadedRevisionId();
  }

  /**
   * {@inheritdoc}
   */
  public function updateLoadedRevisionId() {
    return $this->subject
      ->updateLoadedRevisionId();
  }

  /**
   * {@inheritdoc}
   */
  public function wasDefaultRevision() {
    return $this->subject
      ->wasDefaultRevision();
  }

  /**
   * {@inheritdoc}
   */
  public function isLatestRevision() {
    return $this->subject
      ->isLatestRevision();
  }

  /**
   * {@inheritdoc}
   */
  public function isLatestTranslationAffectedRevision() {
    return $this->subject
      ->isLatestTranslationAffectedRevision();
  }

  /**
   * {@inheritdoc}
   */
  public function isRevisionTranslationAffectedEnforced() {
    return $this->subject
      ->isRevisionTranslationAffectedEnforced();
  }

  /**
   * {@inheritdoc}
   */
  public function setRevisionTranslationAffectedEnforced($enforced) {
    return $this->subject
      ->setRevisionTranslationAffectedEnforced($enforced);
  }

  /**
   * {@inheritdoc}
   */
  public function isDefaultTranslationAffectedOnly() {
    return $this->subject
      ->isDefaultTranslationAffectedOnly();
  }

  /**
   * {@inheritdoc}
   */
  public function setSyncing($status) {
    $this->subject
      ->setSyncing($status);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function isSyncing() {
    return $this->subject
      ->isSyncing();
  }

}

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.
TokenAuthUser::$consumer protected property The activated consumer instance.
TokenAuthUser::$subject protected property The decorator subject.
TokenAuthUser::$token protected property The bearer token.
TokenAuthUser::access public function Checks data value access. Overrides AccessibleInterface::access
TokenAuthUser::activate public function Activates the user. Overrides UserInterface::activate
TokenAuthUser::addCacheableDependency public function Adds a dependency on an object: merges its cacheability metadata. Overrides RefinableCacheableDependencyInterface::addCacheableDependency
TokenAuthUser::addCacheContexts public function Adds cache contexts. Overrides RefinableCacheableDependencyInterface::addCacheContexts
TokenAuthUser::addCacheTags public function Adds cache tags. Overrides RefinableCacheableDependencyInterface::addCacheTags
TokenAuthUser::addRole public function Add a role to a user. Overrides UserInterface::addRole
TokenAuthUser::addTranslation public function Adds a new translation to the translatable object. Overrides TranslatableInterface::addTranslation
TokenAuthUser::baseFieldDefinitions public static function Provides base field definitions for an entity type. Overrides FieldableEntityInterface::baseFieldDefinitions
TokenAuthUser::block public function Blocks the user. Overrides UserInterface::block
TokenAuthUser::bundle public function Gets the bundle of the entity. Overrides EntityInterface::bundle
TokenAuthUser::bundleFieldDefinitions public static function Provides field definitions for a specific bundle. Overrides FieldableEntityInterface::bundleFieldDefinitions
TokenAuthUser::checkExistingPassword public function Checks the existing password if set. Overrides UserInterface::checkExistingPassword
TokenAuthUser::create public static function Constructs a new entity object, without permanently saving it. Overrides EntityInterface::create
TokenAuthUser::createDuplicate public function Creates a duplicate of the entity. Overrides EntityInterface::createDuplicate
TokenAuthUser::delete public function Deletes an entity permanently. Overrides EntityInterface::delete
TokenAuthUser::enforceIsNew public function Enforces an entity to be new. Overrides EntityInterface::enforceIsNew
TokenAuthUser::get public function Gets a field item list. Overrides FieldableEntityInterface::get
TokenAuthUser::getAccountName public function Returns the unaltered login name of this account. Overrides AccountInterface::getAccountName
TokenAuthUser::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyInterface::getCacheContexts
TokenAuthUser::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyInterface::getCacheMaxAge
TokenAuthUser::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyInterface::getCacheTags
TokenAuthUser::getCacheTagsToInvalidate public function Returns the cache tags that should be used to invalidate caches. Overrides EntityInterface::getCacheTagsToInvalidate
TokenAuthUser::getChangedTime public function Gets the timestamp of the last entity change for the current translation. Overrides EntityChangedInterface::getChangedTime
TokenAuthUser::getChangedTimeAcrossTranslations public function Gets the timestamp of the last entity change across all translations. Overrides EntityChangedInterface::getChangedTimeAcrossTranslations
TokenAuthUser::getConfigDependencyKey public function Gets the key that is used to store configuration dependencies. Overrides EntityInterface::getConfigDependencyKey
TokenAuthUser::getConfigDependencyName public function Gets the configuration dependency name. Overrides EntityInterface::getConfigDependencyName
TokenAuthUser::getConfigTarget public function Gets the configuration target identifier for the entity. Overrides EntityInterface::getConfigTarget
TokenAuthUser::getConsumer public function Get the activated consumer. Overrides TokenAuthUserInterface::getConsumer
TokenAuthUser::getCreatedTime public function Returns the creation time of the user as a UNIX timestamp. Overrides UserInterface::getCreatedTime
TokenAuthUser::getDisplayName public function Returns the display name of this account. Overrides AccountInterface::getDisplayName
TokenAuthUser::getEmail public function Returns the email address of this account. Overrides AccountInterface::getEmail
TokenAuthUser::getEntityType public function Gets the entity type definition. Overrides EntityInterface::getEntityType
TokenAuthUser::getEntityTypeId public function Gets the ID of the type of the entity. Overrides EntityInterface::getEntityTypeId
TokenAuthUser::getFieldDefinition public function Gets the definition of a contained field. Overrides FieldableEntityInterface::getFieldDefinition
TokenAuthUser::getFieldDefinitions public function Gets an array of field definitions of all contained fields. Overrides FieldableEntityInterface::getFieldDefinitions
TokenAuthUser::getFields public function Gets an array of all field item lists. Overrides FieldableEntityInterface::getFields
TokenAuthUser::getInitialEmail public function Returns the email that was used when the user was registered. Overrides UserInterface::getInitialEmail
TokenAuthUser::getIterator public function
TokenAuthUser::getLastAccessedTime public function The timestamp when the account last accessed the site. Overrides AccountInterface::getLastAccessedTime
TokenAuthUser::getLastLoginTime public function Returns the UNIX timestamp when the user last logged in. Overrides UserInterface::getLastLoginTime
TokenAuthUser::getLoadedRevisionId public function Gets the loaded Revision ID of the entity. Overrides RevisionableInterface::getLoadedRevisionId
TokenAuthUser::getOriginalId public function Gets the original ID. Overrides EntityInterface::getOriginalId
TokenAuthUser::getPassword public function Returns the hashed password. Overrides UserInterface::getPassword
TokenAuthUser::getPreferredAdminLangcode public function Returns the preferred administrative language code of the account. Overrides AccountInterface::getPreferredAdminLangcode
TokenAuthUser::getPreferredLangcode public function Returns the preferred language code of the account. Overrides AccountInterface::getPreferredLangcode
TokenAuthUser::getRevisionId public function Gets the revision identifier of the entity. Overrides RevisionableInterface::getRevisionId
TokenAuthUser::getRoles public function Returns a list of roles. Overrides AccountInterface::getRoles
TokenAuthUser::getRoleStorage protected function Returns the role storage object.
TokenAuthUser::getTimeZone public function Returns the timezone of this account. Overrides AccountInterface::getTimeZone
TokenAuthUser::getToken public function Get the token. Overrides TokenAuthUserInterface::getToken
TokenAuthUser::getTranslatableFields public function Gets an array of field item lists for translatable fields. Overrides FieldableEntityInterface::getTranslatableFields
TokenAuthUser::getTranslation public function Gets a translation of the data. Overrides TranslatableInterface::getTranslation
TokenAuthUser::getTranslationLanguages public function Returns the languages the data is translated to. Overrides TranslatableInterface::getTranslationLanguages
TokenAuthUser::getTypedData public function Gets a typed data object for this entity object. Overrides EntityInterface::getTypedData
TokenAuthUser::getUntranslated public function Returns the translatable object referring to the original language. Overrides TranslatableInterface::getUntranslated
TokenAuthUser::getUsername public function
TokenAuthUser::hasField public function Determines whether the entity has a field with the given name. Overrides FieldableEntityInterface::hasField
TokenAuthUser::hasLinkTemplate public function Indicates if a link template exists for a given key. Overrides EntityInterface::hasLinkTemplate
TokenAuthUser::hasPermission public function Checks whether a user has a certain permission. Overrides AccountInterface::hasPermission
TokenAuthUser::hasRole public function Whether a user has a certain role. Overrides UserInterface::hasRole
TokenAuthUser::hasTranslation public function Checks there is a translation for the given language code. Overrides TranslatableInterface::hasTranslation
TokenAuthUser::hasTranslationChanges public function Determines if the current translation of the entity has unsaved changes. Overrides TranslatableInterface::hasTranslationChanges
TokenAuthUser::id public function Gets the identifier. Overrides EntityInterface::id
TokenAuthUser::isActive public function Returns TRUE if the user is active. Overrides UserInterface::isActive
TokenAuthUser::isAnonymous public function Returns TRUE if the account is anonymous. Overrides AccountInterface::isAnonymous
TokenAuthUser::isAuthenticated public function Returns TRUE if the account is authenticated. Overrides AccountInterface::isAuthenticated
TokenAuthUser::isBlocked public function Returns TRUE if the user is blocked. Overrides UserInterface::isBlocked
TokenAuthUser::isDefaultRevision public function Checks if this entity is the default revision. Overrides RevisionableInterface::isDefaultRevision
TokenAuthUser::isDefaultTranslation public function Checks whether the translation is the default one. Overrides TranslatableInterface::isDefaultTranslation
TokenAuthUser::isDefaultTranslationAffectedOnly public function Checks if untranslatable fields should affect only the default translation. Overrides TranslatableRevisionableInterface::isDefaultTranslationAffectedOnly
TokenAuthUser::isLatestRevision public function Checks if this entity is the latest revision. Overrides RevisionableInterface::isLatestRevision
TokenAuthUser::isLatestTranslationAffectedRevision public function Checks whether this is the latest revision affecting this translation. Overrides TranslatableRevisionableInterface::isLatestTranslationAffectedRevision
TokenAuthUser::isNew public function Determines whether the entity is new. Overrides EntityInterface::isNew
TokenAuthUser::isNewRevision public function Determines whether a new revision should be created on save. Overrides RevisionableInterface::isNewRevision
TokenAuthUser::isNewTranslation public function Checks whether the translation is new. Overrides TranslatableInterface::isNewTranslation
TokenAuthUser::isRevisionTranslationAffected public function Checks whether the current translation is affected by the current revision. Overrides TranslatableRevisionableInterface::isRevisionTranslationAffected
TokenAuthUser::isRevisionTranslationAffectedEnforced public function Checks if the revision translation affected flag value has been enforced. Overrides TranslatableRevisionableInterface::isRevisionTranslationAffectedEnforced
TokenAuthUser::isSyncing public function Returns whether this entity is being changed as part of a synchronization. Overrides SynchronizableInterface::isSyncing
TokenAuthUser::isTranslatable public function Returns the translation support status. Overrides TranslatableInterface::isTranslatable
TokenAuthUser::isValidationRequired public function Checks whether entity validation is required before saving the entity. Overrides FieldableEntityInterface::isValidationRequired
TokenAuthUser::label public function Gets the label of the entity. Overrides EntityInterface::label
TokenAuthUser::language public function Gets the language of the entity. Overrides EntityInterface::language
TokenAuthUser::link public function
TokenAuthUser::load public static function Loads an entity. Overrides EntityInterface::load
TokenAuthUser::loadMultiple public static function Loads one or more entities. Overrides EntityInterface::loadMultiple
TokenAuthUser::mergeCacheMaxAge public function Merges the maximum age (in seconds) with the existing maximum age. Overrides RefinableCacheableDependencyInterface::mergeCacheMaxAge
TokenAuthUser::onChange public function Reacts to changes to a field. Overrides FieldableEntityInterface::onChange
TokenAuthUser::postCreate public function Acts on a created entity before hooks are invoked. Overrides EntityInterface::postCreate
TokenAuthUser::postDelete public static function Acts on deleted entities before the delete hook is invoked. Overrides EntityInterface::postDelete
TokenAuthUser::postLoad public static function Acts on loaded entities. Overrides EntityInterface::postLoad
TokenAuthUser::postSave public function Acts on a saved entity before the insert or update hook is invoked. Overrides EntityInterface::postSave
TokenAuthUser::preCreate public static function Changes the values of an entity before it is created. Overrides EntityInterface::preCreate
TokenAuthUser::preDelete public static function Acts on entities before they are deleted and before hooks are invoked. Overrides EntityInterface::preDelete
TokenAuthUser::preSave public function Acts on an entity before the presave hook is invoked. Overrides EntityInterface::preSave
TokenAuthUser::preSaveRevision public function Acts on a revision before it gets saved. Overrides RevisionableInterface::preSaveRevision
TokenAuthUser::referencedEntities public function Gets a list of entities referenced by this entity. Overrides EntityInterface::referencedEntities
TokenAuthUser::removeRole public function Remove a role from a user. Overrides UserInterface::removeRole
TokenAuthUser::removeTranslation public function Removes the translation identified by the given language code. Overrides TranslatableInterface::removeTranslation
TokenAuthUser::save public function Saves an entity permanently. Overrides EntityInterface::save
TokenAuthUser::set public function Sets a field value. Overrides FieldableEntityInterface::set
TokenAuthUser::setChangedTime public function Sets the timestamp of the last entity change for the current translation. Overrides EntityChangedInterface::setChangedTime
TokenAuthUser::setEmail public function Sets the email address of the user. Overrides UserInterface::setEmail
TokenAuthUser::setExistingPassword public function Sets the existing plain text password. Overrides UserInterface::setExistingPassword
TokenAuthUser::setLastAccessTime public function Sets the UNIX timestamp when the user last accessed the site.. Overrides UserInterface::setLastAccessTime
TokenAuthUser::setLastLoginTime public function Sets the UNIX timestamp when the user last logged in. Overrides UserInterface::setLastLoginTime
TokenAuthUser::setNewRevision public function Enforces an entity to be saved as a new revision. Overrides RevisionableInterface::setNewRevision
TokenAuthUser::setOriginalId public function Sets the original ID. Overrides EntityInterface::setOriginalId
TokenAuthUser::setPassword public function Sets the user password. Overrides UserInterface::setPassword
TokenAuthUser::setRevisionTranslationAffected public function Marks the current revision translation as affected. Overrides TranslatableRevisionableInterface::setRevisionTranslationAffected
TokenAuthUser::setRevisionTranslationAffectedEnforced public function Enforces the revision translation affected flag value. Overrides TranslatableRevisionableInterface::setRevisionTranslationAffectedEnforced
TokenAuthUser::setSyncing public function Sets the status of the synchronization flag. Overrides SynchronizableInterface::setSyncing
TokenAuthUser::setUsername public function Sets the username of this account. Overrides UserInterface::setUsername
TokenAuthUser::setValidationRequired public function Sets whether entity validation is required before saving the entity. Overrides FieldableEntityInterface::setValidationRequired
TokenAuthUser::toArray public function Gets an array of all field values. Overrides FieldableEntityInterface::toArray
TokenAuthUser::toLink public function Generates the HTML for a link to this entity. Overrides EntityInterface::toLink
TokenAuthUser::toUrl public function Gets the URL object for the entity. Overrides EntityInterface::toUrl
TokenAuthUser::updateLoadedRevisionId public function Updates the loaded Revision ID with the revision ID. Overrides RevisionableInterface::updateLoadedRevisionId
TokenAuthUser::uriRelationships public function Gets a list of URI relationships supported by this entity. Overrides EntityInterface::uriRelationships
TokenAuthUser::url public function
TokenAuthUser::urlInfo public function
TokenAuthUser::uuid public function Gets the entity UUID (Universally Unique Identifier). Overrides EntityInterface::uuid
TokenAuthUser::validate public function Validates the currently set values. Overrides FieldableEntityInterface::validate
TokenAuthUser::wasDefaultRevision public function Checks whether the entity object was a default revision when it was saved. Overrides RevisionableInterface::wasDefaultRevision
TokenAuthUser::__construct public function Constructs a TokenAuthUser object.
UserInterface::REGISTER_ADMINISTRATORS_ONLY constant Only administrators can create user accounts.
UserInterface::REGISTER_VISITORS constant Visitors can create their own accounts.
UserInterface::REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL constant Visitors can create accounts that only become active with admin approval.
UserInterface::TIMEZONE_DEFAULT constant New users will be set to the default time zone at registration.
UserInterface::TIMEZONE_EMPTY constant New users will get an empty time zone at registration.
UserInterface::TIMEZONE_SELECT constant New users will select their own timezone at registration.
UserInterface::USERNAME_MAX_LENGTH constant Maximum length of username text field.