BUG 4119 "Need web service for updating user accounts" SOLVED
- New feature - Web Services for updating user accounts - Added functions "PMFCreateUser, PMFUpdateUser, WSCreateUser, WSUpdateUser" in "class.pmFunctions.php" - Added function "updateUser" in "class.wsBase.php" - Added functionality for applications using Web Services
This commit is contained in:
@@ -1034,6 +1034,7 @@ function WSAssignUserToGroup($userId, $groupId)
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
@@ -1048,9 +1049,9 @@ function WSAssignUserToGroup($userId, $groupId)
|
||||
* @param string(32) | $firstname | Firstname of the new user | The first name(s) of the new user, which can be up to 50 characters long.
|
||||
* @param string(32) | $lastname | Lastname of the new user | The last name(s) of the new user, which can be up to 50 characters long.
|
||||
* @param string(32) | $email | Email the new user | The e-mail of the new user, which can be up to 100 characters long.
|
||||
* @param string(32) | $role | Rol of the new user | The role of the new user, such as 'PROCESSMAKER_ADMIN' and 'PROCESSMAKER_OPERATOR'.
|
||||
* @param string(32) | $dueDate=null | Expiration date | Optional parameter. The expiration date must be a string in the format 'yyyy-mm-dd'.
|
||||
* @param string(32) | $status=null | Status of the new user | Optional parameter. The user's status, such as 'ACTIVE', 'INACTIVE' or 'VACATION'.
|
||||
* @param string(32) | $role | Rol of the new user | The role of the new user, such as "PROCESSMAKER_ADMIN" and "PROCESSMAKER_OPERATOR".
|
||||
* @param string(32) | $dueDate=null | Expiration date | Optional parameter. The expiration date must be a string in the format "yyyy-mm-dd".
|
||||
* @param string(32) | $status=null | Status of the new user | Optional parameter. The user's status, such as "ACTIVE", "INACTIVE" or "VACATION".
|
||||
* @return array | $fields | WS array | A WS Response associative array.
|
||||
*
|
||||
*/
|
||||
@@ -1059,6 +1060,7 @@ function WSCreateUser($userId, $password, $firstname, $lastname, $email, $role,
|
||||
$client = WSOpen();
|
||||
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
|
||||
$params = array(
|
||||
"sessionId" => $sessionId,
|
||||
"userId" => $userId,
|
||||
@@ -1079,6 +1081,65 @@ function WSCreateUser($userId, $password, $firstname, $lastname, $email, $role,
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Update an user in ProcessMaker.
|
||||
*
|
||||
* @name WSUpdateUser
|
||||
* @label WS Update User
|
||||
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#WSUpdateUser.28.29
|
||||
*
|
||||
* @param string(32) | $userUid | User UID | The user UID.
|
||||
* @param string(32) | $userName | User ID | The username for the user.
|
||||
* @param string(32) | $firstName=null | Firstname of the user | Optional parameter. The first name of the user, which can be up to 50 characters long.
|
||||
* @param string(32) | $lastName=null | Lastname of the user | Optional parameter. The last name of the user, which can be up to 50 characters long.
|
||||
* @param string(32) | $email=null | Email the user | Optional parameter. The email of the user, which can be up to 100 characters long.
|
||||
* @param string(32) | $dueDate=null | Expiration date | Optional parameter. The expiration date must be a string in the format "yyyy-mm-dd".
|
||||
* @param string(32) | $status=null | Status of the user | Optional parameter. The user's status, such as "ACTIVE", "INACTIVE" or "VACATION".
|
||||
* @param string(32) | $role=null | Rol of the user | The role of the user such as "PROCESSMAKER_ADMIN" or "PROCESSMAKER_OPERATOR".
|
||||
* @param string(32) | $password=null | Password of the user | The password of the user, which can be up to 32 characters long.
|
||||
* @return array | $fields | WS array | A WS Response associative array.
|
||||
*
|
||||
*/
|
||||
function WSUpdateUser(
|
||||
$userUid,
|
||||
$userName,
|
||||
$firstName=null,
|
||||
$lastName=null,
|
||||
$email=null,
|
||||
$dueDate=null,
|
||||
$status=null,
|
||||
$role=null,
|
||||
$password=null
|
||||
) {
|
||||
$client = WSOpen();
|
||||
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
|
||||
$params = array(
|
||||
"sessionId" => $sessionId,
|
||||
"userUid" => $userUid,
|
||||
"userName" => $userName,
|
||||
"firstName" => $firstName,
|
||||
"lastName" => $lastName,
|
||||
"email" => $email,
|
||||
"dueDate" => $dueDate,
|
||||
"status" => $status,
|
||||
"role" => $role,
|
||||
"password" => $password
|
||||
);
|
||||
|
||||
$result = $client->__soapCall("updateUser", array($params));
|
||||
|
||||
$fields["status_code"] = $result->status_code;
|
||||
$fields["message"] = $result->message;
|
||||
$fields["time_stamp"] = $result->timestamp;
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
@@ -1679,6 +1740,7 @@ function PMFAssignUserToGroup($userId, $groupId)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
@@ -1689,13 +1751,13 @@ function PMFAssignUserToGroup($userId, $groupId)
|
||||
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFCreateUser.28.29
|
||||
*
|
||||
* @param string(32) | $userId | User ID | The username for the new user.
|
||||
* @param string(32) | $password | Password of the new user | The password of the new user, which can be up to 32 characters long.
|
||||
* @param string(32) | $password | Password of the new user | The password of the new user, which can be up to 32 characters long.
|
||||
* @param string(32) | $firstname | Firstname of the new user | The first name of the user, which can be up to 50 characters long.
|
||||
* @param string(32) | $lastname | Lastname of the new user | The last name of the user, which can be up to 50 characters long.
|
||||
* @param string(32) | $email | Email the new user | The email of the new user, which can be up to 100 characters long.
|
||||
* @param string(32) | $role | Rol of the new user | The role of the new user such as 'PROCESSMAKER_ADMIN' or 'PROCESSMAKER_OPERATOR'.
|
||||
* @param string(32) | $dueDate=null | Expiration date | Optional parameter. The expiration date must be a string in the format 'yyyy-mm-dd'.
|
||||
* @param string(32) | $status=null | Status of the new user | Optional parameter. The user's status, such as 'ACTIVE', 'INACTIVE' or 'VACATION'.
|
||||
* @param string(32) | $role | Rol of the new user | The role of the new user such as "PROCESSMAKER_ADMIN" or "PROCESSMAKER_OPERATOR".
|
||||
* @param string(32) | $dueDate=null | Expiration date | Optional parameter. The expiration date must be a string in the format "yyyy-mm-dd".
|
||||
* @param string(32) | $status=null | Status of the new user | Optional parameter. The user's status, such as "ACTIVE", "INACTIVE" or "VACATION".
|
||||
* @return int | $result | Result of the creation | Returns 1 if the new user was created successfully; otherwise, returns 0 if an error occurred.
|
||||
*
|
||||
*/
|
||||
@@ -1712,6 +1774,51 @@ function PMFCreateUser($userId, $password, $firstname, $lastname, $email, $role,
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Update a user with the given data.
|
||||
*
|
||||
* @name PMFUpdateUser
|
||||
* @label PMF Update User
|
||||
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFUpdateUser.28.29
|
||||
*
|
||||
* @param string(32) | $userUid | User UID | The user UID.
|
||||
* @param string(32) | $userName | User ID | The username for the user.
|
||||
* @param string(32) | $firstName=null | Firstname of the user | Optional parameter. The first name of the user, which can be up to 50 characters long.
|
||||
* @param string(32) | $lastName=null | Lastname of the user | Optional parameter. The last name of the user, which can be up to 50 characters long.
|
||||
* @param string(32) | $email=null | Email the user | Optional parameter. The email of the user, which can be up to 100 characters long.
|
||||
* @param string(32) | $dueDate=null | Expiration date | Optional parameter. The expiration date must be a string in the format "yyyy-mm-dd".
|
||||
* @param string(32) | $status=null | Status of the user | Optional parameter. The user's status, such as "ACTIVE", "INACTIVE" or "VACATION".
|
||||
* @param string(32) | $role=null | Rol of the user | The role of the user such as "PROCESSMAKER_ADMIN" or "PROCESSMAKER_OPERATOR".
|
||||
* @param string(32) | $password=null | Password of the user | The password of the user, which can be up to 32 characters long.
|
||||
* @return int | $result | Result of the update | Returns 1 if the user is updated successfully; otherwise, returns 0 if an error occurred.
|
||||
*
|
||||
*/
|
||||
function PMFUpdateUser(
|
||||
$userUid,
|
||||
$userName,
|
||||
$firstName=null,
|
||||
$lastName=null,
|
||||
$email=null,
|
||||
$dueDate=null,
|
||||
$status=null,
|
||||
$role=null,
|
||||
$password=null
|
||||
) {
|
||||
G::LoadClass("wsBase");
|
||||
|
||||
$ws = new wsBase();
|
||||
$result = $ws->updateUser($userUid, $userName, $firstName, $lastName, $email, $dueDate, $status, $role, $password);
|
||||
|
||||
if ($result->status_code == 0) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -198,6 +198,31 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="updateUserRequest">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="sessionId" type="xs:string"/>
|
||||
<xs:element name="userUid" type="xs:string"/>
|
||||
<xs:element name="userName" type="xs:string"/>
|
||||
<xs:element name="firstName" minOccurs="0" maxOccurs="unbounded" type="xs:string"/>
|
||||
<xs:element name="lastName" minOccurs="0" maxOccurs="unbounded" type="xs:string"/>
|
||||
<xs:element name="email" minOccurs="0" maxOccurs="unbounded" type="xs:string"/>
|
||||
<xs:element name="dueDate" minOccurs="0" maxOccurs="unbounded" type="xs:string"/>
|
||||
<xs:element name="status" minOccurs="0" maxOccurs="unbounded" type="xs:string"/>
|
||||
<xs:element name="role" minOccurs="0" maxOccurs="unbounded" type="xs:string"/>
|
||||
<xs:element name="password" minOccurs="0" maxOccurs="unbounded" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="updateUserResponse">
|
||||
<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:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="createGroupRequest">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
@@ -761,6 +786,12 @@
|
||||
<message name="createUserResponse">
|
||||
<part name="parameters" element="xs0:createUserResponse"/>
|
||||
</message>
|
||||
<message name="updateUserRequest">
|
||||
<part name="parameters" element="xs0:updateUserRequest"/>
|
||||
</message>
|
||||
<message name="updateUserResponse">
|
||||
<part name="parameters" element="xs0:updateUserResponse"/>
|
||||
</message>
|
||||
<message name="createGroupRequest">
|
||||
<part name="parameters" element="xs0:createGroupRequest"/>
|
||||
</message>
|
||||
@@ -922,6 +953,10 @@
|
||||
<input message="xs0:createUserRequest"/>
|
||||
<output message="xs0:createUserResponse"/>
|
||||
</operation>
|
||||
<operation name="updateUser">
|
||||
<input message="xs0:updateUserRequest"/>
|
||||
<output message="xs0:updateUserResponse"/>
|
||||
</operation>
|
||||
<operation name="createGroup">
|
||||
<input message="xs0:createGroupRequest"/>
|
||||
<output message="xs0:createGroupResponse"/>
|
||||
@@ -1103,6 +1138,15 @@
|
||||
<soap12:body use="literal"/>
|
||||
</output>
|
||||
</operation>
|
||||
<operation name="updateUser">
|
||||
<soap12:operation soapAction="urn:updateUser" 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>
|
||||
|
||||
@@ -810,6 +810,37 @@ function CreateUser($params)
|
||||
return $res;
|
||||
}
|
||||
|
||||
function updateUser($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->updateUser(
|
||||
$params->userUid,
|
||||
$params->userName,
|
||||
((isset($params->firstName))? $params->firstName : null),
|
||||
((isset($params->lastName))? $params->lastName : null),
|
||||
((isset($params->email))? $params->email : null),
|
||||
((isset($params->dueDate))? $params->dueDate : null),
|
||||
((isset($params->status))? $params->status : null),
|
||||
((isset($params->role))? $params->role : null),
|
||||
((isset($params->password))? $params->password : null)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function CreateGroup($params)
|
||||
{
|
||||
$vsResult = isValidSession($params->sessionId);
|
||||
@@ -1062,6 +1093,7 @@ $server->addFunction("AssignUserToDepartment");
|
||||
$server->addFunction("CreateGroup");
|
||||
$server->addFunction("CreateDepartment");
|
||||
$server->addFunction("CreateUser");
|
||||
$server->addFunction("updateUser");
|
||||
$server->addFunction("getCaseInfo");
|
||||
$server->addFunction("TaskList");
|
||||
$server->addFunction("TaskCase");
|
||||
|
||||
Reference in New Issue
Block a user