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:
@@ -87,19 +87,13 @@ function getCurrentTime ()
|
||||
* @label User Info
|
||||
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#userInfo.28.29
|
||||
*
|
||||
* @param string(32) | $user_id | User ID | The user unique ID
|
||||
* @return array | $userInfo | User Info | An associative array with Information
|
||||
* @param string(32) | $userUid | User ID | The user unique ID
|
||||
* @return array | $info | User Info | An associative array with Information
|
||||
*
|
||||
*/
|
||||
function userInfo ($user_uid)
|
||||
function userInfo($userUid)
|
||||
{
|
||||
try {
|
||||
require_once 'classes/model/Users.php';
|
||||
$oUser = new Users();
|
||||
return $oUser->getAllInformation( $user_uid );
|
||||
} catch (Exception $oException) {
|
||||
throw $oException;
|
||||
}
|
||||
return PMFInformationUser($userUid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1107,6 +1101,40 @@ function WSUpdateUser ($userUid, $userName, $firstName = null, $lastName = null,
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @method Retrieves information about a user with a given ID.
|
||||
*
|
||||
* @name WSInformationUser
|
||||
* @label WS Information User
|
||||
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#WSInformationUser.28.29
|
||||
*
|
||||
* @param string(32) | $userUid | User UID | The user UID.
|
||||
* @return array | $response | WS array | A WS Response associative array.
|
||||
*
|
||||
*/
|
||||
function WSInformationUser($userUid)
|
||||
{
|
||||
$client = WSOpen();
|
||||
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
|
||||
$params = array(
|
||||
"sessionId" => $sessionId,
|
||||
"userUid" => $userUid
|
||||
);
|
||||
|
||||
$result = $client->__soapCall("informationUser", array($params));
|
||||
|
||||
$response = array();
|
||||
$response["status_code"] = $result->status_code;
|
||||
$response["message"] = $result->message;
|
||||
$response["time_stamp"] = $result->timestamp;
|
||||
$response["info"] = (isset($result->info))? $result->info : null;
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @method Returns the unique ID for the current active session.
|
||||
@@ -1851,6 +1879,34 @@ function PMFUpdateUser ($userUid, $userName, $firstName = null, $lastName = null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @method Retrieves information about a user with a given ID.
|
||||
*
|
||||
* @name PMFInformationUser
|
||||
* @label PMF Information User
|
||||
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFInformationUser.28.29
|
||||
*
|
||||
* @param string(32) | $userUid | User UID | The user UID.
|
||||
* @return array | $info | Information of user | An associative array with Information.
|
||||
*
|
||||
*/
|
||||
function PMFInformationUser($userUid)
|
||||
{
|
||||
G::LoadClass("wsBase");
|
||||
|
||||
$ws = new wsBase();
|
||||
$result = $ws->informationUser($userUid);
|
||||
|
||||
$info = array();
|
||||
|
||||
if ($result->status_code == 0 && isset($result->info)) {
|
||||
$info = $result->info;
|
||||
}
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @method Creates a random string of letters and/or numbers of a specified length,which
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -225,6 +225,50 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:complexType name="informationUserStruct">
|
||||
<xs:sequence>
|
||||
<xs:element name="username" type="xs:string"/>
|
||||
<xs:element name="firstname" type="xs:string"/>
|
||||
<xs:element name="lastname" type="xs:string"/>
|
||||
<xs:element name="mail" type="xs:string"/>
|
||||
<xs:element name="address" type="xs:string"/>
|
||||
<xs:element name="zipcode" type="xs:string"/>
|
||||
<xs:element name="country" type="xs:string"/>
|
||||
<xs:element name="state" type="xs:string"/>
|
||||
<xs:element name="location" type="xs:string"/>
|
||||
<xs:element name="phone" type="xs:string"/>
|
||||
<xs:element name="fax" type="xs:string"/>
|
||||
<xs:element name="cellular" type="xs:string"/>
|
||||
<xs:element name="birthday" type="xs:string"/>
|
||||
<xs:element name="position" type="xs:string"/>
|
||||
<xs:element name="replacedby" type="xs:string"/>
|
||||
<xs:element name="duedate" type="xs:string"/>
|
||||
<xs:element name="calendar" type="xs:string"/>
|
||||
<xs:element name="status" type="xs:string"/>
|
||||
<xs:element name="department" type="xs:string"/>
|
||||
<xs:element name="reportsto" type="xs:string"/>
|
||||
<xs:element name="userexperience" type="xs:string"/>
|
||||
<xs:element name="photo" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="informationUserRequest">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="sessionId" type="xs:string"/>
|
||||
<xs:element name="userUid" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="informationUserResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="status_code" type="xs:integer"/>
|
||||
<xs:element name="message" type="xs:string"/>
|
||||
<xs:element name="timestamp" type="xs:string"/>
|
||||
<xs:element name="info" minOccurs="0" maxOccurs="unbounded" type="xs0:informationUserStruct"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="createGroupRequest">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
@@ -896,6 +940,12 @@
|
||||
<message name="updateUserResponse">
|
||||
<part name="parameters" element="xs0:updateUserResponse"/>
|
||||
</message>
|
||||
<message name="informationUserRequest">
|
||||
<part name="parameters" element="xs0:informationUserRequest"/>
|
||||
</message>
|
||||
<message name="informationUserResponse">
|
||||
<part name="parameters" element="xs0:informationUserResponse"/>
|
||||
</message>
|
||||
<message name="createGroupRequest">
|
||||
<part name="parameters" element="xs0:createGroupRequest"/>
|
||||
</message>
|
||||
@@ -1091,6 +1141,10 @@
|
||||
<input message="xs0:updateUserRequest"/>
|
||||
<output message="xs0:updateUserResponse"/>
|
||||
</operation>
|
||||
<operation name="informationUser">
|
||||
<input message="xs0:informationUserRequest"/>
|
||||
<output message="xs0:informationUserResponse"/>
|
||||
</operation>
|
||||
<operation name="createGroup">
|
||||
<input message="xs0:createGroupRequest"/>
|
||||
<output message="xs0:createGroupResponse"/>
|
||||
@@ -1301,6 +1355,15 @@
|
||||
<soap12:body use="literal"/>
|
||||
</output>
|
||||
</operation>
|
||||
<operation name="informationUser">
|
||||
<soap12:operation soapAction="urn:informationUser" soapActionRequired="true" style="document"/>
|
||||
<input>
|
||||
<soap12:body use="literal"/>
|
||||
</input>
|
||||
<output>
|
||||
<soap12:body use="literal"/>
|
||||
</output>
|
||||
</operation>
|
||||
<operation name="createGroup">
|
||||
<soap12:operation soapAction="urn:createGroup" soapActionRequired="true" style="document"/>
|
||||
<input>
|
||||
|
||||
@@ -873,6 +873,26 @@ function updateUser ($params)
|
||||
return $result;
|
||||
}
|
||||
|
||||
function informationUser($params)
|
||||
{
|
||||
$result = isValidSession($params->sessionId);
|
||||
|
||||
if ($result->status_code != 0) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
if (ifPermission($params->sessionId, "PM_USERS") == 0) {
|
||||
$result = new wsResponse(2, "You do not have privileges");
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
$ws = new wsBase();
|
||||
$result = $ws->informationUser($params->userUid);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function CreateGroup ($params)
|
||||
{
|
||||
$vsResult = isValidSession( $params->sessionId );
|
||||
@@ -1171,6 +1191,7 @@ function unpauseCase ($params)
|
||||
}
|
||||
|
||||
$server = new SoapServer($wsdl);
|
||||
|
||||
$server->addFunction("Login");
|
||||
$server->addFunction("ProcessList");
|
||||
$server->addFunction("CaseList");
|
||||
@@ -1199,6 +1220,7 @@ $server->addFunction( "CreateGroup" );
|
||||
$server->addFunction("CreateDepartment");
|
||||
$server->addFunction("CreateUser");
|
||||
$server->addFunction("updateUser");
|
||||
$server->addFunction("informationUser");
|
||||
$server->addFunction("getCaseInfo");
|
||||
$server->addFunction("TaskList");
|
||||
$server->addFunction("TaskCase");
|
||||
|
||||
Reference in New Issue
Block a user