Przeglądaj źródła

add api preauth call

andre 5 lat temu
rodzic
commit
55369c3234
1 zmienionych plików z 43 dodań i 0 usunięć
  1. 43 0
      api/Zm/Account.php

+ 43 - 0
api/Zm/Account.php

@@ -754,6 +754,49 @@ class Zm_Account
 
 		return $result;
 	}
+	/**
+	 * setAccountPassword
+	 * @param string $idOrNameAccount account id or account name
+	 * @param string $password password
+	 * @param string $type value of the account (auto, name, id)
+	 * @return array informations
+	 */
+
+	function getAccountToken($idOrNameAccount, $preauthKey, $expire, $type="auto")
+	{
+		if($type == "auto")
+			$realType = getAccountType($idOrNameAccount);
+		else
+			$realType = $type;
+
+		if($realType == "name")
+			$accountId = $this->getAccountId($idOrNameAccount);
+		else
+			$accountId = $idOrNameAccount;
+
+		$result = null;
+
+		$params = array(
+			new SoapParam($accountId, "id"),
+			new SoapVar('<preauth timestamp="' . time() . ' expires="' . $expire . '">' . $preauthKey . '</preauth>', XSD_ANYXML),
+		);
+
+		try
+		{
+			$result = $this->auth->execSoapCall(
+				"AuthRequest",
+				$params
+			);
+
+//			$result = $result['SOAP:ENVELOPE']['SOAP:BODY']['SETPASSWORDRESPONSE'];
+		}
+		catch (SoapFault $exception)
+		{
+			$result = $exception;
+		}
+
+		return $result;
+	}
 
 	/**
 	 * getAccountCos