Commit b2c5ec488aba4b6867eb2a52990863edf01e6ea4

Authored by Elena.Budnik
1 parent cd308359

corrected Nath. version

Showing 1 changed file with 32 additions and 29 deletions   Show diff stats
php/classes/WSUserMgr.php
... ... @@ -2,62 +2,65 @@
2 2 /**
3 3 * @class WSUserMgr
4 4 * @version $Id: WSUserMgr.php 2806 2015-03-02 15:31:05Z natacha $
5   - *
  5 + * @brief WebServices User Manager
6 6 */
7 7  
8   -
9   -class WSUserMgr extends UserMgr {
10   -
  8 +class WSUserMgr extends UserMgr
  9 +{
11 10 protected $isSoap;
12 11  
13 12 /*****************************************************************
14 13 * PUBLIC FUNCTIONS
15 14 *****************************************************************/
16 15  
17   - public function init($username, $password, $sessionID, $isSoap) {
18   -
  16 + public function init($username, $password, $sessionID, $isSoap)
  17 + {
19 18 $this->user = trim($username);
20 19 $this->sessionID = trim($sessionID);
21   - $this->passwd = trim($password);
22   - $this->userWS = USERPATH . "/" . $this->user . "/WS/";
23   - $this->userdir = USERPATH . "/" . $this->user . "/";
24   - $this->userMissions = $this->getAvailableMissionsByUser();
25   -
26   - chmod($this->userWS, 0775);
27   - if (isset($isSoap)) {
28   - $this->isSoap = $isSoap;
29   - } else $this->isSoap = false;
  20 + $this->passwd = trim($password);
30 21  
31   - $this->setPath();
  22 + $this->isSoap = isset($isSoap);
32 23  
33   - if ($this->ddCheckUser() != 0) {
  24 + // Check if user has DD session already open, otherwise - login
  25 + if ($this->ddCheckUser() != 0)
  26 + {
34 27 if ($this->ddLogin() != 0) { // DD Login if user is not registered
35   - if ($this->isSoap) throw new SoapFault("server00", "Server Error: AMDA Login procedure failed");
36   - else return array("error" => "Server Error: AMDA Login procedure failed");
  28 + if ($this->isSoap) throw new SoapFault("error", "Login procedure failed");
  29 + else return array("error" => "Login procedure failed");
37 30 }
38 31  
39   - if ($this->ddCheckUser() != 0) {
40   - if ($this->isSoap) throw new SoapFault("server01", "Server Error: Check User procedure failed");
41   - else return array("error" => "Server Error: CheckUser procedure failed");
  32 + if ($this->ddCheckUser() != 0)
  33 + {
  34 + if ($this->isSoap) throw new SoapFault("error", "CheckUser procedure failed");
  35 + else return array("error" => "CheckUser procedure failed");
42 36 }
43 37 }
44   -
45   - if (!is_dir($this->userdir)) {
  38 +
  39 + $this->userdir = USERPATH."/".$this->user."/";
  40 +
  41 + if (!is_dir($this->userdir))
  42 + {
46 43 if (!$this->createDir()) {
47   - die("Login for " . $this->user . " failed: Can't create WS dirs");
  44 + if ($this->isSoap) throw new SoapFault("error", "Cannot create UserDir");
  45 + else return array("error" => "Cannot create UserDir");
48 46 }
49   - $this->isFirst = true;
50 47 }
  48 +
  49 + // $this->userWS = USERPATH . "/" . $this->user . "/WS/";
  50 + // chmod($this->userWS, 0775);
  51 + $this->userMissions = $this->getAvailableMissionsByUser();
51 52  
  53 + $this->setPath();
  54 +
52 55 return array('success' => true);
53 56 }
54 57  
55   - public function makeUserWS() {
  58 + public function makeUserWS()
  59 + {
56 60 $this->makeLocalTree();
57 61 $this->makeRemoteTree();
58 62  
59   - return $sessionID = $this->user;
  63 + return $this->user;
60 64 }
61 65 }
62   -
63 66 ?>
64 67 \ No newline at end of file
... ...