You are here

function drd_server_validate_user in Drupal Remote Dashboard Server 6

Ensure that the given user has permission to access drd data.

1 call to drd_server_validate_user()
drd_server_connect in ./drd_server.module

File

./drd_server.module, line 100

Code

function drd_server_validate_user($username, $password) {
  $form_state['values']['name'] = $username;
  $form_state['values']['pass'] = $password;
  $form_state['values']['op'] = t('Login');
  $GLOBALS['drd_xmlrpc_mode'] = TRUE;
  $user = user_authenticate($form_state['values']);
  if (!form_get_errors()) {
    if (user_access('administer site configuration')) {
      return $GLOBALS['user'];
    }
    else {
      return t('You do not have permission to access system data.');
    }
  }
  else {
    return t('Wrong username or password.');
  }
}