diff --git a/php/classes/UserMgr.php b/php/classes/UserMgr.php index 1e50034..b52059f 100644 --- a/php/classes/UserMgr.php +++ b/php/classes/UserMgr.php @@ -23,7 +23,7 @@ class UserMgr 'USERTEMPDIR' => 'TEMP'); protected $userGrps; protected $userGrpsCheckSum; //use to know if there is a modification in user groups - protected $amdaClient; //client to dd webservice + protected $amdaClient = NULL; //client to dd webservice protected $paramMgr, $baseExtXml; protected $datasetsTimeRestriction; protected $datasetsTimeRestrictionCheckSum; @@ -75,10 +75,15 @@ class UserMgr $this->user = $_GET['sessionID']; else if (isset($sessionID)) $this->user = $sessionID; - //TODO if AmdaClient is needed ? - $this->amdaClient = new AmdaClient(); } + private function getAmdaClient() { + if (!isset($this->amdaClient)) { + $this->amdaClient = new AmdaClient(); + } + return $this->amdaClient; + } + //TODO if needed?? set session ID protected function setID() {} @@ -119,7 +124,7 @@ class UserMgr // "email" => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("email") : "undefined", // "date" => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("date") : "undefined", // "news" => ($theUser->length > 0) ? $theUser->item(0)->getAttribute("news") : "0"); - $info = $this->amdaClient->getUserInfo($this->user); + $info = $this->getAmdaClient()->getUserInfo($this->user); $wsSize = intval($this->getWsSize()/1024./1024.); $quota = intval($this->getSpecialSettings()/1024./1024.); $info['total'] = $quota; @@ -131,7 +136,7 @@ class UserMgr public function resetPwd($crt_pwd, $new_pwd) { - return $this->amdaClient->resetUserPwd($this->user, $crt_pwd, $new_pwd); + return $this->getAmdaClient()->resetUserPwd($this->user, $crt_pwd, $new_pwd); } public function createDir() @@ -149,7 +154,7 @@ class UserMgr if (isset($this->userGrps)) { return; } - $info = $this->amdaClient->getUserInfo($this->user); + $info = $this->getAmdaClient()->getUserInfo($this->user); $this->userGrpsCheckSum = ''; if (!empty($info['group'])) { @@ -179,7 +184,7 @@ class UserMgr } $this->datasetsTimeRestrictionCheckSum = ''; - $this->datasetsTimeRestriction = $this->amdaClient->getDatasetsWithTimeRestriction(); + $this->datasetsTimeRestriction = $this->getAmdaClient()->getDatasetsWithTimeRestriction(); if ($this->datasetsTimeRestriction !== FALSE) { foreach ($this->datasetsTimeRestriction as &$datasetTimeRestriction) { -- libgit2 0.21.2