Merged in release/3.4.11 (pull request #7330)

Update release/3.4.11

Approved-by: Paula Quispe <paula.quispe@processmaker.com>
Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Paula Quispe
2020-04-30 18:54:05 +00:00
committed by Julio Cesar Laura Avendaño
5 changed files with 114 additions and 141 deletions

View File

@@ -175,25 +175,40 @@ switch ($request) {
}
break;
case 'recreate-root':
$user = $_POST['user'];
$pass = $_POST['password'];
$server = $_POST['host'];
$code = $_POST['codeCaptcha'];
// Get the post variables
$user = !empty($_POST['user']) ? $_POST['user'] : '';
$pass = !empty($_POST['password']) ? $_POST['password'] : '';
$server = !empty($_POST['host']) ? $_POST['host'] : '';
$code = !empty($_POST['codeCaptcha']) ? $_POST['codeCaptcha'] : '';
// Check if in the host was included the port
$server = explode(':', $server);
$serverName = $server[0];
$port = (count($server) > 1) ? $server[1] : '';
// Review if the captcha is not empty
if (empty($code)) {
echo G::loadTranslation('ID_CAPTCHA_CODE_INCORRECT');
break;
}
// Review if th captcha is incorrect
if ($code !== $_SESSION['securimage_code_disp']['default']) {
echo G::loadTranslation('ID_CAPTCHA_CODE_INCORRECT');
break;
}
list($success, $message) = System::checkPermissionsDbUser(DB_ADAPTER, $serverName, $port, $user, $pass);
if ($success) {
$id = 'ID_MESSAGE_ROOT_CHANGE_FAILURE';
if (System::regenerateCredentiaslPathInstalled($server, $user, $pass)) {
$id = 'ID_MESSAGE_ROOT_CHANGE_SUCESS';
// Define a message of failure
$message = G::loadTranslation('ID_MESSAGE_ROOT_CHANGE_FAILURE');
if (!empty($user) && !empty($pass) && !empty($serverName)) {
list($success, $message) = System::checkPermissionsDbUser(DB_ADAPTER, $serverName, $port, $user, $pass);
if ($success) {
$id = 'ID_MESSAGE_ROOT_CHANGE_FAILURE';
if (System::regenerateCredentiaslPathInstalled($serverName, $user, $pass)) {
$id = 'ID_MESSAGE_ROOT_CHANGE_SUCESS';
}
$message = G::loadTranslation($id);
}
$message = G::loadTranslation($id);
}
echo $message;
break;
case 'captcha':

View File

@@ -1126,26 +1126,26 @@ class Cases
Validator::isString($appUid, '$app_uid');
Validator::appUid($appUid, '$app_uid');
// Review the permission for delete case
global $RBAC;
if ($RBAC->userCanAccess('PM_DELETECASE') != 1) {
throw new Exception(G::LoadTranslation('ID_NOT_ABLE_DELETE_CASES'));
}
// Review the status and user
// Review the status and owner
$caseInfo = ModelApplication::getCase($appUid);
if (!empty($caseInfo)){
if (!empty($caseInfo)) {
// Check if the requester is the owner
if ($caseInfo['APP_INIT_USER'] !== $usrUid) {
global $RBAC;
// If no we need to review if have the permission
if ($RBAC->userCanAccess('PM_DELETECASE') != 1) {
throw new Exception(G::LoadTranslation('ID_NOT_ABLE_DELETE_CASES'));
}
}
// Review the status
if ($caseInfo['APP_STATUS'] != 'DRAFT') {
throw new Exception(G::LoadTranslation("ID_DELETE_CASE_NO_STATUS"));
}
// Review the user requester
if ($caseInfo['APP_INIT_USER'] != $usrUid) {
throw new Exception(G::LoadTranslation("ID_DELETE_CASE_NO_OWNER"));
}
}
$case = new ClassesCases();
$case->removeCase($appUid);
$case = new ClassesCases();
$case->removeCase($appUid);
}
}
/**
@@ -3230,8 +3230,6 @@ class Cases
$arrayApplicationData = $this->getApplicationRecordByPk($applicationUid, [], false);
$arrayApplicationData['APP_DATA'] = $case->unserializeData($arrayApplicationData['APP_DATA']);
$flagDelete = false;
$arrayVariableDocumentToDelete = $this->validateAppDocUid($arrayVariableDocumentToDelete);
foreach ($arrayVariableDocumentToDelete as $key => $value) {
if (is_array($value) && !empty($value)) {
$type = '';
@@ -3256,13 +3254,15 @@ class Cases
$arrayDocumentDelete = $value;
foreach ($arrayDocumentDelete as $value2) {
$appDocument->remove($value2['appDocUid'], (int)($value2['version']));
if ($value2['appDocUid'] !== "") {
$appDocument->remove($value2['appDocUid'], (int)($value2['version']));
$arrayApplicationData['APP_DATA'] = $this->applicationDataDeleteMultipleFile(
$arrayApplicationData['APP_DATA'], $variable, null, $type, $value2
);
$arrayApplicationData['APP_DATA'] = $this->applicationDataDeleteMultipleFile(
$arrayApplicationData['APP_DATA'], $variable, null, $type, $value2
);
$flagDelete = true;
$flagDelete = true;
}
}
break;
case 'GRID':
@@ -3274,13 +3274,15 @@ class Cases
$arrayDocumentDelete = $value3;
foreach ($arrayDocumentDelete as $value4) {
$appDocument->remove($value4['appDocUid'], (int)($value4['version']));
if ($value4['appDocUid'] !== "") {
$appDocument->remove($value4['appDocUid'], (int)($value4['version']));
$arrayApplicationData['APP_DATA'] = $this->applicationDataDeleteMultipleFile(
$arrayApplicationData['APP_DATA'], $grid, $variable, $type, $value4
);
$arrayApplicationData['APP_DATA'] = $this->applicationDataDeleteMultipleFile(
$arrayApplicationData['APP_DATA'], $grid, $variable, $type, $value4
);
$flagDelete = true;
$flagDelete = true;
}
}
}
}
@@ -3316,24 +3318,6 @@ class Cases
}
}
/**
* Validate if all documents have appDocUid
*
* @param array $arrayVariableDocument
*
* @return array
*/
public function validateAppDocUid(array $arrayVariableDocument)
{
$newArrayVariableDocument = [];
foreach ($arrayVariableDocument as $value) {
if (array_key_exists('appDocUid', $value)) {
$newArrayVariableDocument[] = $value;
}
}
return $newArrayVariableDocument;
}
/**
* Get Permissions, Participate, Access, Objects supervisor
*