public static function clients_connection_drupal_services::getUser in Web Service Clients 7
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
1 call to clients_connection_drupal_services::getUser()
- clients_connection_drupal_services::call in backends/
clients_drupal/ clients_drupal.inc - Executes call and processes data
File
- backends/
clients_drupal/ clients_drupal.inc, line 254 - Defines methods and calls to Drupal services
Class
- clients_connection_drupal_services
- General Drupal client class.
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;
}