diff --git a/php/WebServices/WSUserMgr.php b/php/WebServices/WSUserMgr.php index e042327..f08b5a2 100644 --- a/php/WebServices/WSUserMgr.php +++ b/php/WebServices/WSUserMgr.php @@ -55,6 +55,7 @@ class WSUserMgr extends UserMgr if ( $setPathOnly ) return array('success' => true); + $this->userGrps = $this->getUserGrps(); $this->makeLocalTree(); $this->makeRemoteTree(); diff --git a/php/WebServices/WebServer.php b/php/WebServices/WebServer.php index 6ead612..7e497bc 100644 --- a/php/WebServices/WebServer.php +++ b/php/WebServices/WebServer.php @@ -54,10 +54,10 @@ class WebServer return array('success' => true, 'vars' => $vars); } - private function initUserMgr($setPatOnly = false) + private function initUserMgr($setPathOnly = false) { $wsUserMgr = new WSUserMgr(); - $wsUserMgr->init($this->userID, $this->userPWD, $this->sessionID, $setPatOnly, $this->isSoap); + $wsUserMgr->init($this->userID, $this->userPWD, $this->sessionID, $setPathOnly, $this->isSoap); $this->IPclient = $wsUserMgr->getIPClient(); @@ -297,7 +297,34 @@ class WebServer return array('success' => true, 'token' => $newToken); } + + private function excludePrivateNodes($locParamSrc, $locParamDst) + { + $locParamSrcDom = new DomDocument("1.0"); + $locParamSrcDom->preserveWhiteSpace = FALSE; /// Important !!! otherwise removeChild() leaves empty text nodes + + if (!$locParamSrcDom->load($locParamSrc)) + $this->throwError("getObsDataTree", "Cannot load Amda Local DataBase Parameters description file".$this->userID); + + $xp = new domxpath($locParamSrcDom); + $restricted = $xp->query("//*[@group]"); + foreach ($restricted as $node) { + $parentNode = $node->parentNode; + $parentNode->removeChild($node); + + if (!$parentNode->hasChildNodes()) { + if ($parentNode->parentNode){ + $parentParentNode = $parentNode->parentNode; + $parentParentNode->removeChild($parentNode); + } + } + } + + if (!$locParamSrcDom->save(WSConfigClass::getWsResultDir().$locParamDst)) + $this->throwError('workspaceError', 'Cannot save Amda Local DataBase Parameters description file'.$this->userID); + } + /************************** WEB SERVICES **************************************/ /* @@ -309,11 +336,13 @@ class WebServer $this->initUserMgr(); $locParamSrc = USERWSDIR.'LocalParams.xml'; + $locParamDst = substr(strtolower(__FUNCTION__),3).'_'.$this->userID.'_'.$this->requestTime.'_AmdaLocalDataBaseParameters.xml'; - if (!copy($locParamSrc,WSConfigClass::getWsResultDir().$locParamDst)) - $this->throwError('workspaceError', 'No Amda Local DataBase Parameters description file'); +// if (!copy($locParamSrc,WSConfigClass::getWsResultDir().$locParamDst)) +// $this->throwError('workspaceError', 'No Amda Local DataBase Parameters description file'); + $this->excludePrivateNodes($locParamSrc,$locParamDst); return array('success' => true,'WorkSpace' => array("LocalDataBaseParameters" => WSConfigClass::getUrl().$locParamDst)); } @@ -333,8 +362,10 @@ class WebServer $locParamDst = substr(strtolower(__FUNCTION__),3).'_'.$this->userID.'_'.$this->requestTime.'_AmdaLocalDataBaseParameters.xml'; $wsParamDst = substr(strtolower(__FUNCTION__),3).'_'.$this->userID.'_'.$this->requestTime.'_UserDefinedParameters.xml'; - if (!copy($locParamSrc, WSConfigClass::getWsResultDir().$locParamDst)) - $this->throwError('workspaceError', 'No Amda Local DataBase Parameters description file for '.$this->userID); +// if (!copy($locParamSrc, WSConfigClass::getWsResultDir().$locParamDst)) +// $this->throwError('workspaceError', 'No Amda Local DataBase Parameters description file for '.$this->userID); + + $this->excludePrivateNodes($locParamSrc,$locParamDst); if (!copy($wsParamSrc, WSConfigClass::getWsResultDir().$wsParamDst)) return array('success' => true,'ParameterList' => -- libgit2 0.21.2