Commit 32bb889b7d61b66f7f29d9dc43547dae27b6bc93

Authored by Elena.Budnik
1 parent db4f24d1

#5532 to process error Clean Up your WS in batch

Showing 1 changed file with 14 additions and 17 deletions   Show diff stats
php/classes/AmdaAction.php
... ... @@ -868,15 +868,12 @@ class AmdaAction
868 868 */
869 869 private function checkUser($obj)
870 870 {
871   - if (defined('NEWKERNEL_DEBUG') && NEWKERNEL_DEBUG)
872   - {
  871 + if (defined('NEWKERNEL_DEBUG') && NEWKERNEL_DEBUG){
873 872 $this->user = NEWKERNEL_DEBUG_USER;
874 873 return array('success' => true);
875 874 }
876 875  
877   -
878   - if (isset($obj->username) && isset($obj->password) && isset($obj->sessionID))
879   - {
  876 + if (isset($obj->username) && isset($obj->password) && isset($obj->sessionID)) {
880 877 //$dd = new WSUserMgr();
881 878 //$dd->init($obj->username,$obj->password,$obj->sessionID);
882 879 return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support not implemented");
... ... @@ -887,20 +884,17 @@ class AmdaAction
887 884 }
888 885  
889 886 //TODO error handling
890   - if (($res = $dd -> ddCheckUser()) != 0)
891   - {
  887 + if (($res = $dd->ddCheckUser()) != 0) {
892 888 if ($res == 156)
893 889 return array('success' => false, 'message' => 'Your AMDA session is expired.<br/> Login please!');
894 890  
895 891 return array('success' => false, 'message' => 'ddLogin error: '.$res);
896 892 }
897 893  
898   - if ($dd->user == 'impex')
899   - {
  894 + if ($dd->user == 'impex') {
900 895 return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support for IMPEx not implemented");
901 896 }
902   - else
903   - {
  897 + else {
904 898 // check disk space
905 899 if ($dd->getWsSize() > DISK_QUOTA)
906 900 return array('success' => false, 'message' => 'Please clean up your workspace.<br/>No more space is available');
... ... @@ -908,25 +902,28 @@ class AmdaAction
908 902  
909 903 $this->user = $dd->user;
910 904  
911   - return array('success' => true, 'userHost' => $dd -> getIPclient());
  905 + return array('success' => true, 'userHost' => $dd->getIPclient());
912 906 }
913 907  
914 908 private function executeRequest($obj, $function)
915 909 {
916   - if ($function != FunctionTypeEnumClass::PROCESSDELETE) {
  910 + // Check user if access to DD Server and / or possible 'space consuming' action
  911 + if ( $function == FunctionTypeEnumClass::PARAMS ||
  912 + $function == FunctionTypeEnumClass::ACTION ||
  913 + $function == FunctionTypeEnumClass::PARAMSGEN )
  914 + {
917 915 $res = $this->checkUser($obj);
918 916 if (!$res['success']) return $res;
919 917 }
920 918  
921 919 $requestManager = new RequestManagerClass();
922 920  
923   - try
924   - {
  921 + try {
925 922 $res = $requestManager->runIHMRequest($this->user, !empty($res['userHost']) ? $res['userHost'] : NULL, $function, $obj);
926   - } catch (Exception $e)
927   - {
  923 + } catch (Exception $e) {
928 924 return array('success' => false, 'message' => 'Exception detected : '.$e->getMessage());
929 925 }
  926 +
930 927 return $res;
931 928 }
932 929  
... ...