You are here

function casetracker_xmlrpc_validate_user in Case Tracker 5

Ensure that the given user has permission to create cases. Stolen and made relevant for us from blogapi_validate_user().

1 call to casetracker_xmlrpc_validate_user()
casetracker_xmlrpc_new_case in ./casetracker_xmlrpc.module
XML-RPC handler; creates a new case based on incoming values.

File

./casetracker_xmlrpc.module, line 59
Enables Case Tracker cases to be created via XML-RPC.

Code

function casetracker_xmlrpc_validate_user($username, $password) {
  global $user;
  $user = user_authenticate($username, $password);
  if ($user->uid) {
    if (user_access('create cases via XML-RPC')) {
      return $user;

      // authorized. excelsior!
    }
    else {

      // naughty little monkey has tried to overstep bounds. NO BANANAS.
      return t("This account does not have access to create cases via XML-RPC.");
    }
  }
  else {

    ///me clucks disapprovingly.
    return t('Wrong username or password.');
  }
}