From a394ee090eb529ac10cbf588fd0fd8f980397820 Mon Sep 17 00:00:00 2001 From: Nathanael Jourdane Date: Wed, 22 Nov 2017 10:30:34 +0100 Subject: [PATCH] bugFix token --- php/config.php | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------- php/my_config.php | 10 +++++----- php/rest/getDatasetData.php | 19 +++++++++---------- php/rest/getOrbites.php | 13 ++++++------- php/rest/getParameter.php | 13 ++++++------- 5 files changed, 153 insertions(+), 157 deletions(-) diff --git a/php/config.php b/php/config.php index 3cd931a..740a837 100644 --- a/php/config.php +++ b/php/config.php @@ -1,5 +1,5 @@ array( - 'methods'=>array( - 'getTree'=>array('len'=>1), - 'saveTree'=>array('len'=>1), - 'getInfo'=>array('len'=>1), - 'doNothing'=>array('len'=>1), - 'deleteFromTree'=>array('len'=>1), - 'getObject'=>array('len'=>2), - 'getAsciiFile'=>array('len'=>1), - 'getTmpObject'=>array('len'=>3), - 'getUploadedObject'=>array('len'=>3), - 'getMyParamInfo'=>array('len'=>1), - 'deleteObject'=>array('len'=>1), - 'renameObject'=>array('len'=>1), - 'createObject'=>array('len'=>2), - 'modifyObject'=>array('len'=>1), - 'validNameObject'=>array('len'=>1), - 'getJobs'=>array('len'=>0), - 'execute'=>array('len'=>2), - //'formHandler'=>true - 'compilParam'=>array('len'=>1), - 'compilParamDelete'=>array('len'=>1), - 'killPlotRequest'=>array('len'=>0), - 'merge'=>array('len'=>1), - 'intersect'=>array('len'=>1), - 'loadTTIntervals'=>array('len'=>1), - 'saveTTCacheIntervalsInTT'=>array('len'=>1), - 'initTTCache'=>array ('len'=>2), - 'initTTCacheFromTT'=>array('len'=>2), - 'initForChart'=>array('len'=>4), - 'initTTCacheFromTmpObject'=>array('len'=>3), - 'initTTCacheFromUploadedFile'=>array('len'=>3), - 'readTTCacheIntervals'=>array('len'=>1), - 'readIntervalsForChart'=>array('len'=>1), - 'addTTCacheInterval'=>array('len'=>1), - 'removeTTCacheIntervalFromId'=>array('len'=>2), - 'modifyTTCacheInterval'=>array('len'=>1), - 'operationTTCacheIntervals'=>array('len'=>2), - 'mergeTTCacheIntervals'=>array('len'=>0), - 'getTTCacheStatistics'=>array('len'=>0), - 'sendFeedback'=>array('len'=>1), - 'saveState'=>array('len'=>1), - 'loadState'=>array('len'=>1), - 'sendToSAMP'=>array('len'=>1), - 'getHstImagesUrl'=>array('len'=>1), - 'getAPISImagesUrl'=>array('len'=>1), - 'loadFilterList'=>array('len'=>0), - 'loadFilters'=>array('len'=>1), - 'saveFilter'=>array('len'=>1), - 'createFilter'=>array('len'=>1), - 'destroyFilter'=>array('len'=>1), - 'getCrtFilterId'=>array('len'=>0), - 'getCrtFilterResult'=>array('len'=>0), - 'setCrtFilterId'=>array('len'=>1), - 'resetFilter'=>array('len'=>0), - 'logout'=>array('len'=>1), - 'getUserInfo'=>array('len'=>0), - 'convertWS'=>array('len'=>0), - 'getRun'=>array('len'=>1), - 'addRun'=>array('len'=>1), - //AKKA - New action to clean user WS - 'cleanUserWS'=>array('len'=>0), - 'deleteSpecialInfo'=>array('len'=>1), - 'interactivePlot'=>array('len'=>2), - 'getParamPlotInit'=>array('len'=>1), - 'getParamInfo'=>array('len'=>1), - 'getSharedObjectFolders' => array('len'=>1), - 'shareObjects' => array('len'=>1), - 'isSharedObjectNameAlreadyUsed' => array('len'=>1) - ) - ) -); +$API = array('AmdaAction' => array('methods' => array( + 'getTree' => array('len' => 1), + 'saveTree' => array('len' => 1), + 'getInfo' => array('len' => 1), + 'doNothing' => array('len' => 1), + 'deleteFromTree' => array('len' => 1), + 'getObject' => array('len' => 2), + 'getAsciiFile' => array('len' => 1), + 'getTmpObject' => array('len' => 3), + 'getUploadedObject' => array('len' => 3), + 'getMyParamInfo' => array('len' => 1), + 'deleteObject' => array('len' => 1), + 'renameObject' => array('len' => 1), + 'createObject' => array('len' => 2), + 'modifyObject' => array('len' => 1), + 'validNameObject' => array('len' => 1), + 'getJobs' => array('len' => 0), + 'execute' => array('len' => 2), + //'formHandler'=>true + 'compilParam' => array('len' => 1), + 'compilParamDelete' => array('len' => 1), + 'killPlotRequest' => array('len' => 0), + 'merge' => array('len' => 1), + 'intersect' => array('len' => 1), + 'loadTTIntervals' => array('len' => 1), + 'saveTTCacheIntervalsInTT' => array('len' => 1), + 'initTTCache' => array('len' => 2), + 'initTTCacheFromTT' => array('len' => 2), + 'initForChart' => array('len' => 4), + 'initTTCacheFromTmpObject' => array('len' => 3), + 'initTTCacheFromUploadedFile' => array('len' => 3), + 'readTTCacheIntervals' => array('len' => 1), + 'readIntervalsForChart' => array('len' => 1), + 'addTTCacheInterval' => array('len' => 1), + 'removeTTCacheIntervalFromId' => array('len' => 2), + 'modifyTTCacheInterval' => array('len' => 1), + 'operationTTCacheIntervals' => array('len' => 2), + 'mergeTTCacheIntervals' => array('len' => 0), + 'getTTCacheStatistics' => array('len' => 0), + 'sendFeedback' => array('len' => 1), + 'saveState' => array('len' => 1), + 'loadState' => array('len' => 1), + 'sendToSAMP' => array('len' => 1), + 'getHstImagesUrl' => array('len' => 1), + 'getAPISImagesUrl' => array('len' => 1), + 'loadFilterList' => array('len' => 0), + 'loadFilters' => array('len' => 1), + 'saveFilter' => array('len' => 1), + 'createFilter' => array('len' => 1), + 'destroyFilter' => array('len' => 1), + 'getCrtFilterId' => array('len' => 0), + 'getCrtFilterResult' => array('len' => 0), + 'setCrtFilterId' => array('len' => 1), + 'resetFilter' => array('len' => 0), + 'logout' => array('len' => 1), + 'getUserInfo' => array('len' => 0), + 'convertWS' => array('len' => 0), + 'getRun' => array('len' => 1), + 'addRun' => array('len' => 1), + //AKKA - New action to clean user WS + 'cleanUserWS' => array('len' => 0), + 'deleteSpecialInfo' => array('len' => 1), + 'interactivePlot' => array('len' => 2), + 'getParamPlotInit' => array('len' => 1), + 'getParamInfo' => array('len' => 1), + 'getSharedObjectFolders' => array('len' => 1), + 'shareObjects' => array('len' => 1), + 'isSharedObjectNameAlreadyUsed' => array('len' => 1) +))); ?> diff --git a/php/my_config.php b/php/my_config.php index d6ade81..0096554 100644 --- a/php/my_config.php +++ b/php/my_config.php @@ -7,11 +7,11 @@ */ //AKKA - Path to AMDA_Integration base dir -define('INTEGRATION_BASE_PATH', '/home/benjamin/AMDA-GIT/AMDA_Integration/'); +define('INTEGRATION_BASE_PATH', '/AMDA/AMDA_Integration/'); require_once(INTEGRATION_BASE_PATH.'config/AMDAIntegrationConfig.php'); -define('CEFLIB', '/usr/local/cef/lib'); +define('CEFLIB', '/opt/local/cef/lib'); define('CDFLIB', '/opt/local/lib'); define('SYS_LIBS', '/lib:/usr/lib:/usr/local/lib64'); define('SYS_BIN','/bin:/usr/bin/:/usr/local/bin/'); @@ -26,9 +26,9 @@ define('log', IHM_SRC_DIR.'LOG'); // User apache define('APACHE_USER', 'apache'); // Alias for name of AMDA -define('APACHE_ALIAS', '/NEWAMDA-BENJAMIN/'); +define('APACHE_ALIAS', '/NEWAMDA-NJOURDANE/'); //email to send errors from AmdaUpdate/AmdaInstall -define('email','brenard@irap.omp.eu'); +define('email','nathanael.jourdane@irap.omp.eu'); //DDPATH define('DDBIN','/opt/local/bin/'); @@ -36,7 +36,7 @@ define('DDLIB','/opt/local/lib/'); // for updateAmda define('DD_WSDL','http://amda-dev.irap.omp.eu/BASE/DDService/dd.wsdl'); -define('TITLE', 'AMDANEW-Test'); +define('TITLE', 'NEWAMDA-NJOURDANE'); $is64 = true; diff --git a/php/rest/getDatasetData.php b/php/rest/getDatasetData.php index 1ba4652..81915ca 100755 --- a/php/rest/getDatasetData.php +++ b/php/rest/getDatasetData.php @@ -11,23 +11,22 @@ require_once '../config.php'; $amda_ws = new WebServer(); -if (!$_GET["token"]) { - return array('success' => false, 'message' => "E01\nAuthentication is required for this webservice."); -} -if ($amda_ws->getNewToken()['token'] != $_GET["token"]) { - return array('success' => false, 'message' => "E02\nToken expired. Please authenticate again."); +if (!key_exists("token", $_GET)) { + $result = array('success' => false, 'message' => "E01: Authentication is required for this webservice."); +} else if ($amda_ws->getNewToken()['token'] != $_GET["token"]) { + $result = array('success' => false, 'message' => "E02: Token expired. Please authenticate again."); +} else { + $result = $amda_ws->getDataset($_GET); } -$result = $amda_ws->getDataset($_GET); - if ($result['success']) { $file = str_replace("http://oberoi.cesr.fr/AMDA-WS/", BASE_PATH, $result['dataFileURLs']); if ($file) { // header('Content-type: text/xml'); -// $contenu = file_get_contents($file); -// error_log($contenu,3,'/home/natacha/TMP/tmp.xml'); -// echo $contenu; +// $contenu = file_get_contents($file); +// error_log($contenu,3,'/home/natacha/TMP/tmp.xml'); +// echo $contenu; header('Content-type: text/xml'); $doc = new DOMDocument(); diff --git a/php/rest/getOrbites.php b/php/rest/getOrbites.php index e11cfc4..09d29b6 100644 --- a/php/rest/getOrbites.php +++ b/php/rest/getOrbites.php @@ -12,15 +12,14 @@ require_once '../config.php'; $amda_ws = new WebServer(); -if (!$_GET["token"]) { - return array('success' => false, 'message' => "E01\nAuthentication is required for this webservice."); -} -if ($amda_ws->getNewToken()['token'] != $_GET["token"]) { - return array('success' => false, 'message' => "E02\nToken expired. Please authenticate again."); +if (!key_exists("token", $_GET)) { + $result = array('success' => false, 'message' => "E01: Authentication is required for this webservice."); +} else if ($amda_ws->getNewToken()['token'] != $_GET["token"]) { + $result = array('success' => false, 'message' => "E02: Token expired. Please authenticate again."); +} else { + $result = $amda_ws->getOrbites($_GET); } -$result = $amda_ws->getOrbites($_GET); - if ($result['success']) { echo $result['dataFileURLs']; } else { diff --git a/php/rest/getParameter.php b/php/rest/getParameter.php index 05165b4..cf89202 100644 --- a/php/rest/getParameter.php +++ b/php/rest/getParameter.php @@ -12,15 +12,14 @@ require_once '../config.php'; $amda_ws = new WebServer(); -if (!$_GET["token"]) { - return array('success' => false, 'message' => "E01\nAuthentication is required for this webservice."); -} -if ($amda_ws->getNewToken()['token'] != $_GET["token"]) { - return array('success' => false, 'message' => "E02\nToken expired. Please authenticate again."); +if (!key_exists("token", $_GET)) { + $result = array('success' => false, 'message' => "E01: Authentication is required for this webservice."); +} else if ($amda_ws->getNewToken()['token'] != $_GET["token"]) { + $result = array('success' => false, 'message' => "E02: Token expired. Please authenticate again."); +} else { + $result = $amda_ws->getParameter($_GET); } -$result = $amda_ws->getParameter($_GET); - if ($result['success']) { echo $result['dataFileURLs']; } else { -- libgit2 0.21.2