You are here

public static function ClientsServicesDrupal::getUser in Web Service Clients 6

Connects to Drupal Services and logs in the user provided in the config. Returns a session for the user. @todo needs error catching in case service is down

Return value

array

2 calls to ClientsServicesDrupal::getUser()
ClientsServicesDrupal::call in backends/clients_drupal/clients_drupal.inc
Executes call and processes data
clients_drupal_add_validate in backends/clients_drupal/clients_drupal.module
Implementation of hook_validate()

File

backends/clients_drupal/clients_drupal.inc, line 60
Defines methods and calls to Drupal services

Class

ClientsServicesDrupal

Code

public static function getUser($connection) {
  $session = self::connect($connection);
  if ($session->is_error == TRUE) {
    drupal_set_message('There was an error connecting to the service.');
    return;
  }
  $userToken = self::getToken($connection, 'user.login');
  $user = xmlrpc($connection->endpoint, 'user.login', $userToken['hash'], $userToken['domain'], $userToken['timestamp'], $userToken['nonce'], $session['sessid'], $connection->configuration['username'], $connection->configuration['password']);
  if ($user === FALSE) {
    return xmlrpc_error();
  }
  return $user;
}