Commit cd3083596cfcd49b4773e7f359f3d9b99d68b9ee
Exists in
master
and in
111 other branches
Merge branch 'webservices' into 'master'
Webservices 1ere merge request : *Create user dir if necessary when using webservices* See merge request !5
Showing
1 changed file
with
56 additions
and
53 deletions
Show diff stats
php/classes/WSUserMgr.php
... | ... | @@ -2,59 +2,62 @@ |
2 | 2 | /** |
3 | 3 | * @class WSUserMgr |
4 | 4 | * @version $Id: WSUserMgr.php 2806 2015-03-02 15:31:05Z natacha $ |
5 | - * | |
5 | + * | |
6 | 6 | */ |
7 | 7 | |
8 | 8 | |
9 | - class WSUserMgr extends UserMgr { | |
10 | - | |
11 | - protected $isSoap; | |
12 | - | |
13 | -/***************************************************************** | |
14 | -* PUBLIC FUNCTIONS | |
15 | -*****************************************************************/ | |
16 | - | |
17 | - public function init($username,$password,$sessionID,$isSoap) { | |
18 | - | |
19 | - $this->user = trim($username); | |
20 | - $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; | |
30 | - | |
31 | - $this->setPath(); | |
32 | - | |
33 | - | |
34 | - if ($this->ddCheckUser() != 0) { | |
35 | - if ($this->ddLogin() != 0) { // DD Login if user is not registered | |
36 | - if ($this->isSoap) throw new SoapFault("server00","Server Error: AMDA Login procedure failed"); | |
37 | - else return array("error" => "Server Error: AMDA Login procedure failed"); | |
38 | - } | |
39 | - | |
40 | - if ($this->ddCheckUser() != 0) { | |
41 | - if ($this->isSoap) throw new SoapFault("server01","Server Error: Check User procedure failed"); | |
42 | - else return array("error" => "Server Error: CheckUser procedure failed"); | |
43 | - } | |
44 | - | |
45 | - } | |
46 | - return array('success' => true); | |
47 | - | |
48 | - } | |
49 | - | |
50 | - public function makeUserWS(){ | |
51 | - $this->makeLocalTree(); | |
52 | - $this->makeRemoteTree(); | |
53 | - | |
54 | - return $sessionID = $this->user; | |
55 | - | |
56 | - } | |
57 | - | |
58 | - } | |
59 | - | |
60 | -?> | |
9 | +class WSUserMgr extends UserMgr { | |
10 | + | |
11 | + protected $isSoap; | |
12 | + | |
13 | + /***************************************************************** | |
14 | + * PUBLIC FUNCTIONS | |
15 | + *****************************************************************/ | |
16 | + | |
17 | + public function init($username, $password, $sessionID, $isSoap) { | |
18 | + | |
19 | + $this->user = trim($username); | |
20 | + $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; | |
30 | + | |
31 | + $this->setPath(); | |
32 | + | |
33 | + if ($this->ddCheckUser() != 0) { | |
34 | + 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"); | |
37 | + } | |
38 | + | |
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"); | |
42 | + } | |
43 | + } | |
44 | + | |
45 | + if (!is_dir($this->userdir)) { | |
46 | + if (!$this->createDir()) { | |
47 | + die("Login for " . $this->user . " failed: Can't create WS dirs"); | |
48 | + } | |
49 | + $this->isFirst = true; | |
50 | + } | |
51 | + | |
52 | + return array('success' => true); | |
53 | + } | |
54 | + | |
55 | + public function makeUserWS() { | |
56 | + $this->makeLocalTree(); | |
57 | + $this->makeRemoteTree(); | |
58 | + | |
59 | + return $sessionID = $this->user; | |
60 | + } | |
61 | +} | |
62 | + | |
63 | +?> | |
61 | 64 | \ No newline at end of file |
... | ... |