BUG 8596 "Web Services needs a userInfo() function" SOLVED

- New feature
- Web Services for getting information of user
- Added functions "PMFInformationUser, WSInformationUser" in "class.pmFunctions.php"
- Added function "informationUser" in "class.wsBase.php"
- Added functionality for applications using Web Services
* Available from version 2.0.46
This commit is contained in:
Victor Saisa Lopez
2012-11-15 12:56:33 -04:00
parent 520baa83f2
commit ebd1a4747c
4 changed files with 237 additions and 62 deletions

View File

@@ -1217,7 +1217,41 @@ class wsBase
return $result;
} catch (Exception $e) {
$result = wsResponse( 100, $e->getMessage() );
$result = new wsResponse(100, $e->getMessage());
return $result;
}
}
/**
* Information User
* @param string userUid : The user UID.
* @return $result will return an object
*/
public function informationUser($userUid)
{
try {
if (empty($userUid)) {
$result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " userUid");
return $result;
}
$user = new Users();
$userInfo = $user->getAllInformation($userUid);
//Response
$res = new wsResponse(0, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY"));
$result = new stdClass();
$result->status_code = $res->status_code;
$result->message = $res->message;
$result->timestamp = $res->timestamp;
$result->info = $userInfo;
return $result;
} catch (Exception $e) {
$result = new wsResponse(100, $e->getMessage());
return $result;
}
@@ -1648,7 +1682,7 @@ class wsBase
$this->originalValues['INDEX'] = $_SESSION['INDEX'];
unset( $_SESSION['INDEX'] );
}
if (isset( $_SESSION['USER_LOGGED'] )) {
$this->originalValues['USER_LOGGED'] = $_SESSION['USER_LOGGED'];
unset( $_SESSION['USER_LOGGED'] );
@@ -1664,7 +1698,7 @@ class wsBase
unset( $_SESSION['STEP_POSITION'] );
}
}
/**
* restore the Session variables with values of $originalValues array, if this is set.
*
@@ -1696,7 +1730,7 @@ class wsBase
$_SESSION['USR_USERNAME'] = $this->originalValues['USR_USERNAME'];
unset( $this->originalValues['USR_USERNAME']);
}
if (isset( $this->originalValues['USER_LOGGED'] )) {
$_SESSION['USER_LOGGED'] = $this->originalValues['USER_LOGGED'];
unset( $this->originalValues['USER_LOGGED']);
@@ -1720,9 +1754,9 @@ class wsBase
public function newCase ($processId, $userId, $taskId, $variables)
{
try {
$this->saveTemporarySessionVars();
$Fields = array ();
if (is_array( $variables ) && count( $variables ) > 0) {
@@ -1796,7 +1830,7 @@ class wsBase
$up_case = $oCase->updateCase( $caseId, $oldFields );
$this->restoreSessionVars();
$result = new wsResponse( 0, G::loadTranslation( 'ID_STARTED_SUCCESSFULLY' ) );
$result->caseId = $caseId;
$result->caseNumber = $caseNr;
@@ -2839,7 +2873,7 @@ class wsBase
return $result;
} catch (Exception $e) {
$result = wsResponse( 100, $e->getMessage() );
$result = new wsResponse(100, $e->getMessage());
return $result;
}
@@ -2885,7 +2919,7 @@ class wsBase
return $result;
} catch (Exception $e) {
$result = wsResponse( 100, $e->getMessage() );
$result = new wsResponse(100, $e->getMessage());
return $result;
}
@@ -2941,7 +2975,7 @@ class wsBase
return $result;
} catch (Exception $e) {
$result = wsResponse( 100, $e->getMessage() );
$result = new wsResponse(100, $e->getMessage());
return $result;
}
@@ -2987,7 +3021,7 @@ class wsBase
return $result;
} catch (Exception $e) {
$result = wsResponse( 100, $e->getMessage() );
$result = new wsResponse(100, $e->getMessage());
return $result;
}