From c148f4c336d01dfc33a3527fc3a8d03322b2a232 Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Fri, 21 Feb 2014 16:10:09 -0400 Subject: [PATCH 1/3] Se adiciona validacion para download en FILESMANAGER --- workflow/engine/src/BusinessModel/FilesManager.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/workflow/engine/src/BusinessModel/FilesManager.php b/workflow/engine/src/BusinessModel/FilesManager.php index b8f583977..53d74a198 100644 --- a/workflow/engine/src/BusinessModel/FilesManager.php +++ b/workflow/engine/src/BusinessModel/FilesManager.php @@ -421,8 +421,12 @@ class FilesManager $sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sfile; break; } - $oProcessMap = new \processMap(new \DBConnection()); - $oProcessMap->downloadFile($sProcessUID,$sMainDirectory,$sSubDirectory,$sfile); + if (file_exists(PATH_SEP.$sDirectory)) { + $oProcessMap = new \processMap(new \DBConnection()); + $oProcessMap->downloadFile($sProcessUID,$sMainDirectory,$sSubDirectory,$sfile); + } else { + throw (new \Exception( 'invalid value specified for `path`.')); + } } catch (Exception $e) { throw $e; } From 473d76f3f55c589a487a8e02a64ff77ab68ee757 Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Fri, 21 Feb 2014 16:31:52 -0400 Subject: [PATCH 2/3] Se mejora BEHAT para upload PMUSER y FILESMANAGER --- .../basic_sequence_files_manager.feature | 2 +- .../pm_user/basic_sequence_pm_user.feature | 2 +- features/bootstrap/RestContext.php | 33 ++++++++++++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/features/backend/files_manager/basic_sequence_files_manager.feature b/features/backend/files_manager/basic_sequence_files_manager.feature index 146e38164..68d5d7ffb 100644 --- a/features/backend/files_manager/basic_sequence_files_manager.feature +++ b/features/backend/files_manager/basic_sequence_files_manager.feature @@ -86,7 +86,7 @@ Feature: Files Manager Resources #Para que funcione este test, debe existir el archivo que se quiere subir Scenario: Post files - Given POST I want to upload the file "/home/daniel/test.txt" to path "public". Url to create prf_uid "http://daniel.pmos.colosa.net/api/1.0/daniel/project/1265557095225ff5c688f46031700471/file-manager" and updload "http://daniel.pmos.colosa.net/api/1.0/daniel/project/1265557095225ff5c688f46031700471/file-manager/upload" + Given POST I want to upload the file "/home/daniel/test.txt" to path "public". Url to create prf_uid "project/1265557095225ff5c688f46031700471/file-manager" and updload "project/1265557095225ff5c688f46031700471/file-manager/upload" Scenario: Delete file Given that I want to delete a "public/test.txt" diff --git a/features/backend/pm_user/basic_sequence_pm_user.feature b/features/backend/pm_user/basic_sequence_pm_user.feature index 64302976d..401c38747 100644 --- a/features/backend/pm_user/basic_sequence_pm_user.feature +++ b/features/backend/pm_user/basic_sequence_pm_user.feature @@ -35,7 +35,7 @@ Feature: User #GET /api/1.0/{workspace}/user/{usr_uid} # Upload a image Scenario: Upload a image - Given POST I want to upload the image "/home/daniel/pic2.jpg" to user "00000000000000000000000000000001". Url "http://daniel.pmos.colosa.net/api/1.0/daniel/user/" + Given POST I want to upload the image "/home/daniel/pic3.jpg" to user "00000000000000000000000000000001". Url "user/" #POST /api/1.0/{workspace}/user # Create new User diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index 10fb06e68..ab7a7e6c2 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1318,6 +1318,9 @@ class RestContext extends BehatContext */ public function postIWantToUploadTheFileToPathPublicUrlToCreatePrfUidAndUpdload($prfFile, $prfPath, $postUrl, $url) { + $baseUrl = $this->getParameter('base_url'); + $postUrl = $baseUrl.$postUrl; + $url = $baseUrl.$url; $accesstoken = $this->getParameter('access_token'); $headr = array(); $headr[] = 'Authorization: Bearer '.$accesstoken; @@ -1350,7 +1353,8 @@ class RestContext extends BehatContext */ public function postIWantToUploadTheImageToUser($imageFile, $usrUid, $url) { - $url = $url.$usrUid."/image-upload"; + $baseUrl = $this->getParameter('base_url'); + $url = $baseUrl.$url.$usrUid."/image-upload"; $accesstoken = $this->getParameter('access_token'); $headr = array(); $headr[] = 'Authorization: Bearer '.$accesstoken; @@ -1364,5 +1368,32 @@ class RestContext extends BehatContext curl_close($ch); echo $postResult; } + + /** + * @When /^I request download "([^"]*)"$/ + */ + public function iRequestDownload($pageUrl, $urlType="") + { + $this->_startTime = microtime(true); + $baseUrl = $this->getParameter('base_url'); + if ($this->access_token != null) { + $this->_headers['Authorization'] = 'Bearer ' . $this->access_token; + } + if($urlType=="absolute"){ + $this->_requestUrl = $pageUrl; + }else{ + $this->_requestUrl = $baseUrl . $pageUrl; + } + $url = false !== strpos($pageUrl, '{') + ? array($this->_requestUrl, (array)$this->_restObject) + : $this->_requestUrl; + if (isset($this->_restGetQueryStringSuffix) && + $this->_restGetQueryStringSuffix != '') { + $url .= $this->_restGetQueryStringSuffix; + } + $this->_request = $this->_client ->get($url, $this->_headers); + $this->_response = $this->_request->send(); + echo $this->_response->getBody(true); + } } From a4ec875bbc67a99585ec7613a43f4e2f0746fdbd Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Fri, 21 Feb 2014 16:32:46 -0400 Subject: [PATCH 3/3] Se mejora BEHAT para upload PMUSER y FILESMANAGER --- features/bootstrap/RestContext.php | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index ab7a7e6c2..e6e26edca 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1368,32 +1368,5 @@ class RestContext extends BehatContext curl_close($ch); echo $postResult; } - - /** - * @When /^I request download "([^"]*)"$/ - */ - public function iRequestDownload($pageUrl, $urlType="") - { - $this->_startTime = microtime(true); - $baseUrl = $this->getParameter('base_url'); - if ($this->access_token != null) { - $this->_headers['Authorization'] = 'Bearer ' . $this->access_token; - } - if($urlType=="absolute"){ - $this->_requestUrl = $pageUrl; - }else{ - $this->_requestUrl = $baseUrl . $pageUrl; - } - $url = false !== strpos($pageUrl, '{') - ? array($this->_requestUrl, (array)$this->_restObject) - : $this->_requestUrl; - if (isset($this->_restGetQueryStringSuffix) && - $this->_restGetQueryStringSuffix != '') { - $url .= $this->_restGetQueryStringSuffix; - } - $this->_request = $this->_client ->get($url, $this->_headers); - $this->_response = $this->_request->send(); - echo $this->_response->getBody(true); - } }