You are here

function acquia_connector_test_get_communication_settings in Acquia Connector 7.3

Same name and namespace in other branches
  1. 7.2 acquia_agent/tests/acquia_connector_test.module \acquia_connector_test_get_communication_settings()

Test get settings.

1 call to acquia_connector_test_get_communication_settings()
acquia_connector_test_xmlrpc_server_emulator in acquia_agent/tests/acquia_connector_test.module
Needs comment.
1 string reference to 'acquia_connector_test_get_communication_settings'
acquia_connector_test_xmlrpc in acquia_agent/tests/acquia_connector_test.module
Test xmlrpc.

File

acquia_agent/tests/acquia_connector_test.module, line 206
Test endpoint for Acquia Connector XML-RPC calls.

Code

function acquia_connector_test_get_communication_settings($data) {

  // Authenticate.
  $fields = array(
    'time' => 'is_numeric',
    'nonce' => 'is_string',
    'hash' => 'is_string',
  );
  $result = acquia_connector_test_basic_authenticator($fields, $data);
  if (!empty($result->is_error)) {
    return $result;
  }
  if (!isset($data['body']) || !isset($data['body']['email'])) {
    return xmlrpc_error(ACQSUBSCRIPTION_VALIDATION_ERROR, t('Invalid arguments'));
  }
  $account = user_load_by_mail($data['body']['email']);
  if (empty($account) || $account->uid == 0) {
    return xmlrpc_error(ACQUIA_CONNECTOR_TEST_SUBSCRIPTION_VALIDATION_ERROR, t('Account not found'));
  }
  else {
    $result = array(
      'algorithm' => 'sha512',
      'hash_setting' => substr($account->pass, 0, 12),
      'extra_md5' => FALSE,
    );
    return $result;
  }
  return TRUE;
}