Resolve conflict

This commit is contained in:
Paula Quispe
2017-08-25 18:30:41 -04:00
7 changed files with 745 additions and 512 deletions

View File

@@ -519,6 +519,7 @@ class WebApplication
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
define('SYS_SKIN', $arraySystemConfiguration['default_skin']);
define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $arraySystemConfiguration['disable_download_documents_session_validation']);
require_once(PATH_DB . SYS_SYS . "/db.php");

View File

@@ -5717,13 +5717,13 @@ class Cases
*/
public function getAllObjectsFrom($proUid, $appUid, $tasUid = '', $usrUid = '', $action = '', $delIndex = 0)
{
$aCase = $this->loadCase($appUid);
$caseData = $this->loadCase($appUid);
if ($delIndex != 0) {
$appDelay = new AppDelay();
if ($appDelay->isPaused($appUid, $delIndex)) {
$aCase["APP_STATUS"] = "PAUSED";
$caseData["APP_STATUS"] = "PAUSED";
}
}
@@ -5742,8 +5742,8 @@ class Cases
);
$oObjectPermission = new ObjectPermission();
$userPermissions = $oObjectPermission->verifyObjectPermissionPerUser($usrUid, $proUid, $tasUid, $action, $aCase);
$groupPermissions = $oObjectPermission->verifyObjectPermissionPerGroup($usrUid, $proUid, $tasUid, $action, $aCase);
$userPermissions = $oObjectPermission->verifyObjectPermissionPerUser($usrUid, $proUid, $tasUid, $action, $caseData);
$groupPermissions = $oObjectPermission->verifyObjectPermissionPerGroup($usrUid, $proUid, $tasUid, $action, $caseData);
$permissions = array_merge($userPermissions, $groupPermissions);
foreach ($permissions as $row) {
@@ -5783,7 +5783,7 @@ class Cases
$appUid,
$opTaskSource,
$opObjUid,
$aCase['APP_STATUS']
$caseData['APP_STATUS']
);
//For Ouputs
$result['OUTPUT'] = $oObjectPermission->objectPermissionByOutputInput(
@@ -5792,7 +5792,7 @@ class Cases
$opTaskSource,
'OUTPUT',
$opObjUid,
$aCase['APP_STATUS']
$caseData['APP_STATUS']
);
//For Inputs
$result['INPUT'] = $oObjectPermission->objectPermissionByOutputInput(
@@ -5801,7 +5801,7 @@ class Cases
$opTaskSource,
'INPUT',
$opObjUid,
$aCase['APP_STATUS']
$caseData['APP_STATUS']
);
//For Attachment
$result['ATTACHMENT'] = $oObjectPermission->objectPermissionByOutputInput(
@@ -5810,7 +5810,7 @@ class Cases
$opTaskSource,
'ATTACHED',
$opObjUid,
$aCase['APP_STATUS']
$caseData['APP_STATUS']
);
$result['CASES_NOTES'] = 1;
@@ -5826,7 +5826,7 @@ class Cases
$action,
$opTaskSource,
$opUserRelation,
$aCase['APP_STATUS'],
$caseData['APP_STATUS'],
$opParticipated
);
break;
@@ -5835,7 +5835,7 @@ class Cases
$appUid,
$opTaskSource,
$opObjUid,
$aCase['APP_STATUS']
$caseData['APP_STATUS']
);
break;
case 'INPUT':
@@ -5845,7 +5845,7 @@ class Cases
$opTaskSource,
'INPUT',
$opObjUid,
$aCase['APP_STATUS']
$caseData['APP_STATUS']
);
break;
case 'ATTACHMENT':
@@ -5855,7 +5855,7 @@ class Cases
$opTaskSource,
'ATTACHED',
$opObjUid,
$aCase['APP_STATUS']
$caseData['APP_STATUS']
);
break;
case 'OUTPUT':
@@ -5865,7 +5865,7 @@ class Cases
$opTaskSource,
'OUTPUT',
$opObjUid,
$aCase['APP_STATUS']
$caseData['APP_STATUS']
);
break;
case 'CASES_NOTES':
@@ -5884,7 +5884,7 @@ class Cases
$action,
$opTaskSource,
$opUserRelation,
$aCase['APP_STATUS'],
$caseData['APP_STATUS'],
$opParticipated
);
break;

View File

@@ -157,10 +157,11 @@ class ObjectPermission extends BaseObjectPermission
* @param string $proUid the uid of the process
* @param string $tasUid the uid of the task
* @param string $action for the object permissions VIEW, BLOCK, RESEND
* @param array $caseData for review the case status DRAFT, TODO, COMPLETED, PAUSED
*
* @return array
*/
public function verifyObjectPermissionPerUser ($usrUid, $proUid, $tasUid = '', $action = '', $caseInfo = array())
public function verifyObjectPermissionPerUser ($usrUid, $proUid, $tasUid = '', $action = '', $caseData = array())
{
$userPermissions = array();
$oCriteria = new Criteria('workflow');
@@ -188,7 +189,7 @@ class ObjectPermission extends BaseObjectPermission
$row = $rs->getRow();
if ($row["OP_CASE_STATUS"] == "ALL" || $row["OP_CASE_STATUS"] == "" || $row["OP_CASE_STATUS"] == "0" ||
$row["OP_CASE_STATUS"] == $caseInfo["APP_STATUS"]
$row["OP_CASE_STATUS"] == $caseData["APP_STATUS"]
) {
array_push($userPermissions, $row);
}
@@ -203,10 +204,11 @@ class ObjectPermission extends BaseObjectPermission
* @param string $proUid the uid of the process
* @param string $tasUid the uid of the task
* @param string $action for the object permissions VIEW, BLOCK, RESEND
* @param array $caseData for review the case status DRAFT, TODO, COMPLETED, PAUSED
*
* @return array
*/
public function verifyObjectPermissionPerGroup ($usrUid, $proUid, $tasUid = '', $action = '')
public function verifyObjectPermissionPerGroup ($usrUid, $proUid, $tasUid = '', $action = '', $caseData = array())
{
$gr = new Groups();
$records = $gr->getActiveGroupsForAnUser($usrUid);
@@ -231,7 +233,7 @@ class ObjectPermission extends BaseObjectPermission
$row = $rs->getRow();
if ($row["OP_CASE_STATUS"] == "ALL" || $row["OP_CASE_STATUS"] == "" || $row["OP_CASE_STATUS"] == "0" ||
$row["OP_CASE_STATUS"] == $aCase["APP_STATUS"]
$row["OP_CASE_STATUS"] == $caseData["APP_STATUS"]
) {
array_push($groupPermissions, $row);
}

File diff suppressed because it is too large Load Diff

View File

@@ -5,6 +5,7 @@ use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
use \ProcessMaker\Util\DateTime;
use \ProcessMaker\BusinessModel\Validator;
use AppDocument;
/**
* Cases Api Controller
@@ -108,7 +109,27 @@ class Cases extends Api
}
}
break;
}
case 'doDownloadInputDocument':
//Verify if the user can be download the file
$appDocUid = $this->parameters[$arrayArgs['app_doc_uid']];
$version = $this->parameters[$arrayArgs['v']];
$usrUid = $this->getUserId();
$oAppDocument = new AppDocument();
if ($version == 0) {
$docVersion = $oAppDocument->getLastAppDocVersion($appDocUid);
} else {
$docVersion = $version;
}
if (defined('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION') && DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION == 0) {
if ($oAppDocument->canDownloadInput($usrUid, $appDocUid, $docVersion)) {
return true;
}
} else {
return true;
}
break;
}
return false;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());

View File

@@ -3,6 +3,8 @@ namespace ProcessMaker\Services\Api\Cases;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
use ProcessMaker\BusinessModel\Cases\InputDocument AS CasesInputDocument;
use Exception;
/**
* Cases\InputDocument Api Controller
@@ -54,6 +56,8 @@ class InputDocument extends Api
}
/**
* @access protected
* @class AccessControl {@className \ProcessMaker\Services\Api\Cases}
* @url GET /:app_uid/input-document/:app_doc_uid/file
*
* @param string $app_uid {@min 32}{@max 32}
@@ -111,5 +115,24 @@ class InputDocument extends Api
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:app_uid/input-document/:app_doc_uid/versions
*
* @param string $app_uid {@min 32}{@max 32}
* @param string $app_doc_uid {@min 32}{@max 32}
* @return array $response
* @throws Exception
*/
public function doGetDocumentByVersion($app_uid, $app_doc_uid)
{
try {
$inputDocument = new CasesInputDocument();
$response = $inputDocument->getAllVersionByDocUid($app_uid, $app_doc_uid);
return $response;
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
}