You are here

public function Storage::getUserDetails in OAuth2 Server 7

File

lib/Drupal/oauth2_server/Storage.php, line 315

Class

Storage
Provides Drupal storage (through the underlying Entity API) for the library.

Namespace

Drupal\oauth2_server

Code

public function getUserDetails($username) {
  $account = user_load_by_name($username);
  if (!$account) {

    // An email address might have been supplied instead of the username.
    $account = user_load_by_mail($username);
  }
  if ($account) {
    return array(
      'user_id' => $account->uid,
    );
  }
  return FALSE;
}