Resolve conflict
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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());
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user