You are here

public function AuthorizationCode::getUser in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/AuthorizationCode.php \Drupal\oauth2_server\Entity\AuthorizationCode::getUser()

Return the user the code belongs to.

Return value

\Drupal\user\UserInterface The user object or FALSE.

Overrides AuthorizationCodeInterface::getUser

File

src/Entity/AuthorizationCode.php, line 86

Class

AuthorizationCode
Defines the OAuth2 server authorization code entity.

Namespace

Drupal\oauth2_server\Entity

Code

public function getUser() {
  if ($uid = $this->uid
    ->getValue()) {
    return $this
      ->entityTypeManager()
      ->getStorage('user')
      ->load($uid[0]['target_id']);
  }
  return FALSE;
}