Blame view

php/classes/WSUserMgr.php 1.48 KB
16035364   Benjamin Renard   First commit
1
2
3
4
<?php
/**
 * @class WSUserMgr
 * @version $Id: WSUserMgr.php 2806 2015-03-02 15:31:05Z natacha $
4111d47d   Nathanael Jourdane   use coding conven...
5
 *
16035364   Benjamin Renard   First commit
6
7
8
 */


4111d47d   Nathanael Jourdane   use coding conven...
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class WSUserMgr extends UserMgr
{

	protected $isSoap;

	/*****************************************************************
	 *                           PUBLIC FUNCTIONS
	 *****************************************************************/

	public function init($username, $password, $sessionID, $isSoap)
	{

		$this->user = trim($username);
		$this->sessionID = trim($sessionID);
		$this->passwd = trim($password);
		$this->userWS = USERPATH . "/" . $this->user . "/WS/";
		$this->userdir = USERPATH . "/" . $this->user . "/";
		$this->userMissions = $this->getAvailableMissionsByUser();

		chmod($this->userWS, 0775);
		if (isset($isSoap)) {
			$this->isSoap = $isSoap;
		} else $this->isSoap = false;

		$this->setPath();


		if ($this->ddCheckUser() != 0) {
			if ($this->ddLogin() != 0) { // DD Login if user is not registered
				if ($this->isSoap) throw new SoapFault("server00", "Server Error: AMDA Login procedure failed");
				else return array("error" => "Server Error: AMDA Login procedure failed");
			}

			if ($this->ddCheckUser() != 0) {
				if ($this->isSoap) throw new SoapFault("server01", "Server Error: Check User procedure failed");
				else return array("error" => "Server Error: CheckUser procedure failed");
			}

		}
		return array('success' => true);

	}

	public function makeUserWS()
	{
		$this->makeLocalTree();
		$this->makeRemoteTree();

		return $sessionID = $this->user;
	}
}

?>