Commit e5ab198f61b8d95facfcfca2dd36d6d5106a2fe2

Authored by Nathanaël Jourdane
1 parent e1cef6b5

simple getStatus

php/classes/AmdaAction.php
... ... @@ -844,9 +844,9 @@ class AmdaAction
844 844 /*
845 845 * Get Jobs en cours
846 846 */
847   - public function getJobs()
  847 + public function getJobs($obj)
848 848 {
849   - require_once(INTEGRATION_SRC_DIR."RequestManager.php");
  849 + require_once(INTEGRATION_SRC_DIR."RequestManager.php");
850 850 return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSRUNNINGINFO);
851 851 }
852 852  
... ... @@ -865,9 +865,9 @@ class AmdaAction
865 865  
866 866 if (isset($obj->username) && isset($obj->password) && isset($obj->sessionID))
867 867 {
868   - //$dd = new WSUserMgr();
869   - //$dd->init($obj->username,$obj->password,$obj->sessionID);
870   - return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support not implemented");
  868 + $dd = new WSUserMgr();
  869 + $dd->init($obj->username,$obj->password,$obj->sessionID);
  870 +// return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support not implemented");
871 871 }
872 872 else
873 873 $dd = new UserMgr();
... ... @@ -885,7 +885,7 @@ class AmdaAction
885 885 {
886 886 //if ($dd->getWsSize() > DISK_QUOTA * 100)
887 887 // error_log('Natacha! It is time to CLEAN UP IMPEX WS!',1,'nbourrel@irap.omp.eu');
888   - return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support for IMPEx not implemented");
  888 +// return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support for IMPEx not implemented");
889 889 }
890 890 else
891 891 {
... ... @@ -901,7 +901,7 @@ class AmdaAction
901 901  
902 902 private function executeRequest($obj, $function)
903 903 {
904   - $res = $this->checkUser($obj);
  904 + $res = $this->checkUser($obj);
905 905 if (!$res['success']) return $res;
906 906  
907 907 $requestManager = new RequestManagerClass();
... ...
php/classes/UserMgr.php
... ... @@ -28,7 +28,7 @@ class UserMgr
28 28 public $isNewInfo = false;
29 29 public $isSpecialInfo = null;
30 30  
31   - function __construct($username,$password,$sessionID)
  31 + function __construct($username = null, $password = null, $sessionID = null)
32 32 {
33 33 // if magic quotes is on, stripslashes
34 34 if(get_magic_quotes_gpc())
... ... @@ -78,7 +78,7 @@ class UserMgr
78 78 else if (isset($sessionID))
79 79 $this->user = $sessionID;
80 80 $this->amdaClient = new AmdaClient(true);
81   - }
  81 + }
82 82  
83 83 //TODO if needed?? set session ID
84 84 protected function setID() {}
... ... @@ -491,9 +491,13 @@ class UserMgr
491 491  
492 492 public function ddCheckUser()
493 493 {
  494 + error_log("Checking user...");
494 495 $this->IP = $this->getIPclient();
  496 + error_log("User: " . $this->user);
  497 + error_log("IP: " . $this->IP);
495 498  
496   - $cmdCheckUser = DDBIN."DDCheckUser ".$this->IP." ".$this->user." 1> /dev/null 2> /dev/null";
  499 + $cmdCheckUser = DDBIN."DDCheckUser ".$this->IP." ".$this->user." 1> /dev/null 2> /dev/null";
  500 + error_log("cmdCheckUser: " . $cmdCheckUser);
497 501 system($cmdCheckUser, $res);
498 502 return $res;
499 503 }
... ...
php/classes/WebServer.php
... ... @@ -112,6 +112,9 @@ class WebServer
112 112 $this->userPWD = $vars['password'];
113 113 else
114 114 $this->userPWD = 'impexfp7';
  115 +
  116 +
  117 +
115 118 return array('success' => true, 'vars' => $vars);
116 119 }
117 120  
... ... @@ -492,6 +495,16 @@ class WebServer
492 495  
493 496 }
494 497  
  498 + public function getStatus($data) {
  499 + $obj = (object)array(
  500 + "username" => $this->userID,
  501 + "password" => $this->userPWD,
  502 + "sessionID" => $this->sessionID
  503 + );
  504 +
  505 + $aa = new AmdaAction();
  506 + return $aa->getJobs($obj);
  507 + }
495 508  
496 509 public function getParameterList($data)
497 510 {
... ... @@ -927,7 +940,7 @@ class WebServer
927 940 "fileformat" => $fileformat,
928 941 "timeformat" => $timeformat,
929 942 "compression" => $compression,
930   - "disablebatch" => true
  943 + "disablebatch" => false
931 944 );
932 945  
933 946 if (!isset($this->requestManager))
... ...
php/rest/getStatus.php 0 → 100644
... ... @@ -0,0 +1,19 @@
  1 +<?php
  2 +
  3 +/**
  4 + * @file getStatus.php
  5 + * @brief REST interface for service getParameter
  6 + *
  7 + * @version $Id: $
  8 + */
  9 +//
  10 +//
  11 +// 3€/m <50Go
  12 +//
  13 +require_once '../config.php';
  14 +
  15 +$amda_ws = new WebServer();
  16 +$result = $amda_ws->getStatus($_GET);
  17 +
  18 +echo '<pre>' . var_export($result, true) . '</pre>';
  19 +?>
0 20 \ No newline at end of file
... ...