Commit 41dacd789b17e6896e55c558fdf9c0d5be1d7a0f
Exists in
master
and in
109 other branches
Merge branch 'groups-for-webservices' into 'master'
Groups for webservices See merge request !29
Showing
2 changed files
with
38 additions
and
6 deletions
Show diff stats
php/WebServices/WSUserMgr.php
php/WebServices/WebServer.php
... | ... | @@ -54,10 +54,10 @@ class WebServer |
54 | 54 | return array('success' => true, 'vars' => $vars); |
55 | 55 | } |
56 | 56 | |
57 | - private function initUserMgr($setPatOnly = false) | |
57 | + private function initUserMgr($setPathOnly = false) | |
58 | 58 | { |
59 | 59 | $wsUserMgr = new WSUserMgr(); |
60 | - $wsUserMgr->init($this->userID, $this->userPWD, $this->sessionID, $setPatOnly, $this->isSoap); | |
60 | + $wsUserMgr->init($this->userID, $this->userPWD, $this->sessionID, $setPathOnly, $this->isSoap); | |
61 | 61 | |
62 | 62 | $this->IPclient = $wsUserMgr->getIPClient(); |
63 | 63 | |
... | ... | @@ -297,7 +297,34 @@ class WebServer |
297 | 297 | |
298 | 298 | return array('success' => true, 'token' => $newToken); |
299 | 299 | } |
300 | + | |
301 | + private function excludePrivateNodes($locParamSrc, $locParamDst) | |
302 | + { | |
303 | + $locParamSrcDom = new DomDocument("1.0"); | |
304 | + $locParamSrcDom->preserveWhiteSpace = FALSE; /// Important !!! otherwise removeChild() leaves empty text nodes | |
305 | + | |
306 | + if (!$locParamSrcDom->load($locParamSrc)) | |
307 | + $this->throwError("getObsDataTree", "Cannot load Amda Local DataBase Parameters description file".$this->userID); | |
308 | + | |
309 | + $xp = new domxpath($locParamSrcDom); | |
310 | + $restricted = $xp->query("//*[@group]"); | |
300 | 311 | |
312 | + foreach ($restricted as $node) { | |
313 | + $parentNode = $node->parentNode; | |
314 | + $parentNode->removeChild($node); | |
315 | + | |
316 | + if (!$parentNode->hasChildNodes()) { | |
317 | + if ($parentNode->parentNode){ | |
318 | + $parentParentNode = $parentNode->parentNode; | |
319 | + $parentParentNode->removeChild($parentNode); | |
320 | + } | |
321 | + } | |
322 | + } | |
323 | + | |
324 | + if (!$locParamSrcDom->save(WSConfigClass::getWsResultDir().$locParamDst)) | |
325 | + $this->throwError('workspaceError', 'Cannot save Amda Local DataBase Parameters description file'.$this->userID); | |
326 | + } | |
327 | + | |
301 | 328 | /************************** WEB SERVICES **************************************/ |
302 | 329 | |
303 | 330 | /* |
... | ... | @@ -309,11 +336,13 @@ class WebServer |
309 | 336 | $this->initUserMgr(); |
310 | 337 | |
311 | 338 | $locParamSrc = USERWSDIR.'LocalParams.xml'; |
339 | + | |
312 | 340 | $locParamDst = substr(strtolower(__FUNCTION__),3).'_'.$this->userID.'_'.$this->requestTime.'_AmdaLocalDataBaseParameters.xml'; |
313 | 341 | |
314 | - if (!copy($locParamSrc,WSConfigClass::getWsResultDir().$locParamDst)) | |
315 | - $this->throwError('workspaceError', 'No Amda Local DataBase Parameters description file'); | |
342 | +// if (!copy($locParamSrc,WSConfigClass::getWsResultDir().$locParamDst)) | |
343 | +// $this->throwError('workspaceError', 'No Amda Local DataBase Parameters description file'); | |
316 | 344 | |
345 | + $this->excludePrivateNodes($locParamSrc,$locParamDst); | |
317 | 346 | return array('success' => true,'WorkSpace' => array("LocalDataBaseParameters" => WSConfigClass::getUrl().$locParamDst)); |
318 | 347 | } |
319 | 348 | |
... | ... | @@ -333,8 +362,10 @@ class WebServer |
333 | 362 | $locParamDst = substr(strtolower(__FUNCTION__),3).'_'.$this->userID.'_'.$this->requestTime.'_AmdaLocalDataBaseParameters.xml'; |
334 | 363 | $wsParamDst = substr(strtolower(__FUNCTION__),3).'_'.$this->userID.'_'.$this->requestTime.'_UserDefinedParameters.xml'; |
335 | 364 | |
336 | - if (!copy($locParamSrc, WSConfigClass::getWsResultDir().$locParamDst)) | |
337 | - $this->throwError('workspaceError', 'No Amda Local DataBase Parameters description file for '.$this->userID); | |
365 | +// if (!copy($locParamSrc, WSConfigClass::getWsResultDir().$locParamDst)) | |
366 | +// $this->throwError('workspaceError', 'No Amda Local DataBase Parameters description file for '.$this->userID); | |
367 | + | |
368 | + $this->excludePrivateNodes($locParamSrc,$locParamDst); | |
338 | 369 | |
339 | 370 | if (!copy($wsParamSrc, WSConfigClass::getWsResultDir().$wsParamDst)) |
340 | 371 | return array('success' => true,'ParameterList' => |
... | ... |