Account.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  1. <?php
  2. /**
  3. * Zm_Account
  4. *
  5. * @author Yannick Lorenz <ylorenz@1g6.biz>
  6. * @author Fabrizio La Rosa <fabrizio.larosa@unime.it>
  7. * @version 2.2
  8. * @copyright Copyright (c) 2009, Yannick Lorenz
  9. * @copyright Copyright (c) 2012, Fabrizio La Rosa
  10. * @example ../test.php
  11. */
  12. /**
  13. * Zm_Account class documentation
  14. */
  15. // utils.php contains a small collection of useful functions
  16. require_once ("utils.php");
  17. /**
  18. * Zm_Account is a class which allows to manage Zimbra accounts via SOAP
  19. *
  20. * You may create, modify, rename, delete and get the attributes of a Zimbra account using this class
  21. *
  22. * For the usage examples of all class methods check the source code of test.php
  23. */
  24. class Zm_Account
  25. {
  26. /**
  27. * $auth
  28. * @var Zm_Auth $auth soap authentication
  29. */
  30. private $auth;
  31. /**
  32. * Constructor
  33. * @param Zm_Auth $auth soap authentication
  34. */
  35. function __construct($auth)
  36. {
  37. $this->auth = $auth;
  38. }
  39. /**
  40. * getAllAccounts
  41. * @deprecated it may take a long time to complete and fail on servers with lots of accounts
  42. *
  43. * use fetchAccounts instead
  44. * @param string $idOrNameDomain domain id or domain name
  45. * @param string $type value of the domain (auto, name, id)
  46. * @return array informations for all accounts
  47. */
  48. function getAllAccounts($idOrNameDomain, $type="auto")
  49. {
  50. if($type == "auto")
  51. $realType = getDomainType($idOrNameDomain);
  52. else
  53. $realType = $type;
  54. $result = null;
  55. $params = array(
  56. new SoapVar('<ns1:domain by="' . $realType . '">' . $idOrNameDomain . '</ns1:domain>', XSD_ANYXML),
  57. );
  58. try
  59. {
  60. $result = $this->auth->execSoapCall(
  61. "GetAllAccountsRequest",
  62. $params
  63. );
  64. $result = $result['SOAP:ENVELOPE']['SOAP:BODY']['GETALLACCOUNTSRESPONSE']['ACCOUNT'];
  65. }
  66. catch (SoapFault $exception)
  67. {
  68. $result = $exception;
  69. }
  70. return $result;
  71. }
  72. /**
  73. * fetchAccounts
  74. * @param string $ldapQuery LDAP-style filter string (RFC 2254)
  75. * @param array $attrList names of requested attributes
  76. * @param string $nameDomain domain name to restrict search request
  77. * @return array informations for accounts as specified in $ldapQuery
  78. * @author Marc Lamouche <marc.lamouche@ined.fr>
  79. */
  80. function fetchAccounts($ldapQuery, $attrList, $nameDomain = null)
  81. {
  82. $result = null;
  83. $params = array(
  84. new SoapVar('<ns1:query>'.$ldapQuery.'</ns1:query>', XSD_ANYXML),
  85. new SoapParam("accounts", "types"),
  86. new SoapParam(implode(',', $attrList), "attrs"),
  87. new SoapParam("0", "limit"),
  88. );
  89. if ( is_string($nameDomain) ) $params[] = new SoapParam($nameDomain, "domain");
  90. try
  91. {
  92. $response = $this->auth->execSoapCall(
  93. "SearchDirectoryRequest",
  94. $params
  95. );
  96. $result = array();
  97. $resultCount = intval($response['SOAP:ENVELOPE']['SOAP:BODY']['SEARCHDIRECTORYRESPONSE']['SEARCHTOTAL']);
  98. if ( !$resultCount ) return $result;
  99. if ( $resultCount > 1 )
  100. $accountList = &$response['SOAP:ENVELOPE']['SOAP:BODY']['SEARCHDIRECTORYRESPONSE']['ACCOUNT'];
  101. else
  102. $accountList = array(&$response['SOAP:ENVELOPE']['SOAP:BODY']['SEARCHDIRECTORYRESPONSE']['ACCOUNT']);
  103. foreach($accountList as $account)
  104. {
  105. $data = array();
  106. foreach($attrList as $attrName)
  107. $data[$attrName] = getSoapAttribute($account['A'], $attrName, ATTR_MULTIVALUE);
  108. $result[] = $data;
  109. unset($data);
  110. }
  111. }
  112. catch (SoapFault $exception)
  113. {
  114. $result = $exception;
  115. }
  116. return $result;
  117. }
  118. /**
  119. * getAccount
  120. * @param string $name account name
  121. * @return string account informations
  122. */
  123. function getAccount($name)
  124. {
  125. $result = null;
  126. $params = array(
  127. new SoapVar('<ns1:account by="name">' . $name . '</ns1:account>', XSD_ANYXML),
  128. );
  129. try
  130. {
  131. $result = $this->auth->execSoapCall(
  132. "GetAccountRequest",
  133. $params
  134. );
  135. $result = $result['SOAP:ENVELOPE']['SOAP:BODY']['GETACCOUNTRESPONSE']['ACCOUNT'];
  136. }
  137. catch (SoapFault $exception)
  138. {
  139. $result = $exception;
  140. }
  141. return $result;
  142. }
  143. /**
  144. * getQuota
  145. * @param string $name account name
  146. * @return string account informations
  147. */
  148. function getQuota($name)
  149. {
  150. $result = null;
  151. $params = array(
  152. new SoapVar('<ns1:account by="name">' . $name . '</ns1:account>', XSD_ANYXML),
  153. );
  154. try
  155. {
  156. $result = $this->auth->execSoapCall(
  157. "GetAccountRequest",
  158. $params
  159. );
  160. $result = getSoapAttribute($result['SOAP:ENVELOPE']['SOAP:BODY']['GETACCOUNTRESPONSE']['ACCOUNT']['A'], "zimbraMailQuota");
  161. }
  162. catch (SoapFault $exception)
  163. {
  164. $result = $exception;
  165. }
  166. return $result;
  167. }
  168. /**
  169. * getAccountId
  170. * @param string $name account name
  171. * @return string account id
  172. */
  173. function getAccountId($name)
  174. {
  175. $result = null;
  176. $params = array(
  177. new SoapVar('<ns1:account by="name">' . $name . '</ns1:account>', XSD_ANYXML),
  178. );
  179. try
  180. {
  181. $result = $this->auth->execSoapCall(
  182. "GetAccountInfoRequest",
  183. $params
  184. );
  185. $result = getSoapAttribute($result['SOAP:ENVELOPE']['SOAP:BODY']['GETACCOUNTINFORESPONSE']['A'], "zimbraId");
  186. }
  187. catch (SoapFault $exception)
  188. {
  189. $result = $exception;
  190. }
  191. return $result;
  192. }
  193. /**
  194. * accountExists
  195. * @param string $idOrNameAccount account id or account name
  196. * @param string $type value of the account (auto, name, id)
  197. * @return bool exists
  198. */
  199. function accountExists($idOrNameAccount, $type="auto")
  200. {
  201. if($type == "auto")
  202. $realType = getAccountType($idOrNameAccount);
  203. else
  204. $realType = $type;
  205. $result = null;
  206. $params = array(
  207. new SoapVar('<ns1:account by="' . $realType . '">' . $idOrNameAccount . '</ns1:account>', XSD_ANYXML),
  208. );
  209. $options = array(
  210. 'retry' => false,
  211. );
  212. try
  213. {
  214. $result = $this->auth->execSoapCall(
  215. "GetAccountInfoRequest",
  216. $params,
  217. $options
  218. );
  219. }
  220. catch (SoapFault $exception)
  221. {
  222. $result = $exception;
  223. }
  224. return (!is_a($result, "Exception"));
  225. }
  226. /**
  227. * getAccountInfo
  228. * @param string $idOrNameAccount account id or account name
  229. * @param string $type value of the account (auto, name, id)
  230. * @return array informations
  231. */
  232. function getAccountInfo($idOrNameAccount, $type="auto")
  233. {
  234. if($type == "auto")
  235. $realType = getAccountType($idOrNameAccount);
  236. else
  237. $realType = $type;
  238. $result = null;
  239. $params = array(
  240. new SoapVar('<ns1:account by="' . $realType . '">' . $idOrNameAccount . '</ns1:account>', XSD_ANYXML),
  241. );
  242. try
  243. {
  244. $result = $this->auth->execSoapCall(
  245. "GetAccountInfoRequest",
  246. $params
  247. );
  248. }
  249. catch (SoapFault $exception)
  250. {
  251. $result = $exception;
  252. }
  253. return $result;
  254. }
  255. /**
  256. * getAccountOption
  257. * @param string $idOrNameAccount account id or account name
  258. * @param string $optName name of the option to get
  259. * @param int $multisingle (ATTR_SINGLEVALUE, ATTR_MULTIVALUE)
  260. * @param string $type value of the account (auto, name, id)
  261. * @return string option
  262. */
  263. function getAccountOption($idOrNameAccount, $optName, $multisingle=ATTR_SINGLEVALUE, $type="auto")
  264. {
  265. if($type == "auto")
  266. $realType = getAccountType($idOrNameAccount);
  267. else
  268. $realType = $type;
  269. $result = null;
  270. $params = array(
  271. new SoapVar('<ns1:account by="' . $realType . '">' . $idOrNameAccount . '</ns1:account>', XSD_ANYXML),
  272. );
  273. try
  274. {
  275. $result = $this->auth->execSoapCall(
  276. "GetAccountRequest",
  277. $params
  278. );
  279. $result = getSoapAttribute($result['SOAP:ENVELOPE']['SOAP:BODY']['GETACCOUNTRESPONSE']['ACCOUNT']['A'], $optName, $multisingle);
  280. }
  281. catch (SoapFault $exception)
  282. {
  283. $result = $exception;
  284. }
  285. return $result;
  286. }
  287. /**
  288. * getAccountOptions
  289. * @param string $idOrNameAccount account id or account name
  290. * @param string $type value of the account (auto, name, id)
  291. * @return array options
  292. */
  293. function getAccountOptions($idOrNameAccount, $type="auto")
  294. {
  295. if($type == "auto")
  296. $realType = getAccountType($idOrNameAccount);
  297. else
  298. $realType = $type;
  299. $result = null;
  300. $params = array(
  301. new SoapVar('<ns1:account by="' . $realType . '">' . $idOrNameAccount . '</ns1:account>', XSD_ANYXML),
  302. );
  303. try
  304. {
  305. $result = $this->auth->execSoapCall(
  306. "GetAccountRequest",
  307. $params
  308. );
  309. $attrs = array();
  310. foreach ($result['SOAP:ENVELOPE']['SOAP:BODY']['GETACCOUNTRESPONSE']['ACCOUNT']['A'] as $a) {
  311. $attrs[$a['N']] = $a['DATA'];
  312. }
  313. $result = $attrs;
  314. }
  315. catch (SoapFault $exception)
  316. {
  317. $result = $exception;
  318. }
  319. return $result;
  320. }
  321. /**
  322. * createAccount
  323. * @param string $name account name
  324. * @param string $password password
  325. * @param array $attrs an optional array containing the account attributes to be set
  326. * @return string the new account's id
  327. */
  328. function createAccount($name, $password, $attrs = array())
  329. {
  330. $result = null;
  331. $params = array(
  332. new SoapParam($name, "name"),
  333. new SoapParam($password, "password"),
  334. );
  335. foreach ($attrs as $key=>$value)
  336. $params[] = new SoapVar('<ns1:a n="' . $key . '">' . $value . '</ns1:a>', XSD_ANYXML);
  337. try
  338. {
  339. $result = $this->auth->execSoapCall(
  340. "CreateAccountRequest",
  341. $params
  342. );
  343. $result = $result['SOAP:ENVELOPE']['SOAP:BODY']['CREATEACCOUNTRESPONSE']['ACCOUNT']['ID'];
  344. usleep(250000); // introduce a small delay, otherwise some troubles may arise if we modify the new account right after its creation
  345. }
  346. catch (SoapFault $exception)
  347. {
  348. $result = $exception;
  349. }
  350. return $result;
  351. }
  352. /**
  353. * setAccountPassword
  354. * @param string $idOrNameAccount account id or account name
  355. * @param string $password password
  356. * @param string $type value of the account (auto, name, id)
  357. * @return array informations
  358. */
  359. function setAccountPassword($idOrNameAccount, $password, $type="auto")
  360. {
  361. if($type == "auto")
  362. $realType = getAccountType($idOrNameAccount);
  363. else
  364. $realType = $type;
  365. if($realType == "name")
  366. $accountId = $this->getAccountId($idOrNameAccount);
  367. else
  368. $accountId = $idOrNameAccount;
  369. $result = null;
  370. $params = array(
  371. new SoapParam($accountId, "id"),
  372. new SoapParam($password, "newPassword"),
  373. );
  374. try
  375. {
  376. $result = $this->auth->execSoapCall(
  377. "SetPasswordRequest",
  378. $params
  379. );
  380. $result = $result['SOAP:ENVELOPE']['SOAP:BODY']['SETPASSWORDRESPONSE'];
  381. }
  382. catch (SoapFault $exception)
  383. {
  384. $result = $exception;
  385. }
  386. return $result;
  387. }
  388. /**
  389. * modifyAccount
  390. * @param string $idOrNameAccount account id or account name
  391. * @param array $attrs an array containing the account attributes to be set
  392. * @param string $type value of the account (auto, name, id)
  393. * @return array informations
  394. */
  395. function modifyAccount($idOrNameAccount, $attrs = array(), $type="auto")
  396. {
  397. if($type == "auto")
  398. $realType = getAccountType($idOrNameAccount);
  399. else
  400. $realType = $type;
  401. if($realType == "name")
  402. $accountId = $this->getAccountId($idOrNameAccount);
  403. else
  404. $accountId = $idOrNameAccount;
  405. $result = null;
  406. $params = array(
  407. new SoapParam($accountId, "id"),
  408. );
  409. foreach ($attrs as $key=>$value)
  410. $params[] = new SoapVar('<ns1:a n="' . $key . '">' . $value . '</ns1:a>', XSD_ANYXML);
  411. try
  412. {
  413. $result = $this->auth->execSoapCall(
  414. "ModifyAccountRequest",
  415. $params
  416. );
  417. }
  418. catch (SoapFault $exception)
  419. {
  420. $result = $exception;
  421. }
  422. return $result;
  423. }
  424. /**
  425. * renameAccount
  426. * @param string $idOrNameAccount account id or account name
  427. * @param string $newName new account name
  428. * @param string $type value of the account (auto, name, id)
  429. * @return array informations
  430. */
  431. function renameAccount($idOrNameAccount, $newName, $type="auto")
  432. {
  433. if($type == "auto")
  434. $realType = getAccountType($idOrNameAccount);
  435. else
  436. $realType = $type;
  437. if($realType == "name")
  438. $accountId = $this->getAccountId($idOrNameAccount);
  439. else
  440. $accountId = $idOrNameAccount;
  441. $result = null;
  442. $params = array(
  443. new SoapParam($accountId, "id"),
  444. new SoapParam($newName, "newName"),
  445. );
  446. try
  447. {
  448. $result = $this->auth->execSoapCall(
  449. "RenameAccountRequest",
  450. $params
  451. );
  452. }
  453. catch (SoapFault $exception)
  454. {
  455. $result = $exception;
  456. }
  457. return $result;
  458. }
  459. /**
  460. * deleteAccount
  461. * @param string $idOrNameAccount account id or account name
  462. * @param string $type value of the account (auto, name, id)
  463. * @return array informations
  464. */
  465. function deleteAccount($idOrNameAccount, $type="auto")
  466. {
  467. if($type == "auto")
  468. $realType = getAccountType($idOrNameAccount);
  469. else
  470. $realType = $type;
  471. if($realType == "name")
  472. $accountId = $this->getAccountId($idOrNameAccount);
  473. else
  474. $accountId = $idOrNameAccount;
  475. $result = null;
  476. $params = array(
  477. new SoapParam($accountId, "id"),
  478. );
  479. try
  480. {
  481. $result = $this->auth->execSoapCall(
  482. "DeleteAccountRequest",
  483. $params
  484. );
  485. }
  486. catch (SoapFault $exception)
  487. {
  488. $result = $exception;
  489. }
  490. return $result;
  491. }
  492. /**
  493. * getAccountAliases
  494. * @param string $idOrNameAccount account id or account name
  495. * @param string $type value of the account (auto, name, id)
  496. * @return array aliases
  497. */
  498. function getAccountAliases($idOrNameAccount, $type="auto")
  499. {
  500. return $this->getAccountOption($idOrNameAccount, "zimbraMailAlias", ATTR_MULTIVALUE, $type);
  501. }
  502. /**
  503. * addAccountAlias
  504. * @param string $idOrNameAccount account id or account name
  505. * @param string $alias account alias
  506. * @param string $type value of the account (auto, name, id)
  507. * @return array informations
  508. */
  509. function addAccountAlias($idOrNameAccount, $alias, $type="auto")
  510. {
  511. if($type == "auto")
  512. $realType = getAccountType($idOrNameAccount);
  513. else
  514. $realType = $type;
  515. if($realType == "name")
  516. $accountId = $this->getAccountId($idOrNameAccount);
  517. else
  518. $accountId = $idOrNameAccount;
  519. $result = null;
  520. $params = array(
  521. new SoapParam($accountId, "id"),
  522. new SoapParam($alias, "alias"),
  523. );
  524. try
  525. {
  526. $result = $this->auth->execSoapCall(
  527. "AddAccountAliasRequest",
  528. $params
  529. );
  530. }
  531. catch (SoapFault $exception)
  532. {
  533. $result = $exception;
  534. }
  535. return $result;
  536. }
  537. /**
  538. * removeAccountAlias
  539. * @param string $idOrNameAccount account id or account name
  540. * @param string $alias account alias
  541. * @param string $type value of the account (auto, name, id)
  542. * @return array informations
  543. */
  544. function removeAccountAlias($idOrNameAccount, $alias, $type="auto")
  545. {
  546. if($type == "auto")
  547. $realType = getAccountType($idOrNameAccount);
  548. else
  549. $realType = $type;
  550. if($realType == "name")
  551. $accountId = $this->getAccountId($idOrNameAccount);
  552. else
  553. $accountId = $idOrNameAccount;
  554. $result = null;
  555. $params = array(
  556. new SoapParam($accountId, "id"),
  557. new SoapParam($alias, "alias"),
  558. );
  559. try
  560. {
  561. $result = $this->auth->execSoapCall(
  562. "RemoveAccountAliasRequest",
  563. $params
  564. );
  565. }
  566. catch (SoapFault $exception)
  567. {
  568. $result = $exception;
  569. }
  570. return $result;
  571. }
  572. /**
  573. * getAccountStatus
  574. * @param string $idOrNameAccount account id or account name
  575. * @param string $type value of the account (auto, name, id)
  576. * @return string status
  577. */
  578. function getAccountStatus($idOrNameAccount, $type="auto")
  579. {
  580. return $this->getAccountOption($idOrNameAccount, "zimbraAccountStatus", ATTR_SINGLEVALUE, $type);
  581. }
  582. /**
  583. * setAccountStatus
  584. * @param string $idOrNameAccount account id or account name
  585. * @param string $status the status (active, maintenance, pending, locked, closed)
  586. * @param string $type value of the account (auto, name, id)
  587. * @return array informations
  588. */
  589. function setAccountStatus($idOrNameAccount, $status, $type = "auto")
  590. {
  591. $hideInGAL = ($status == "active") ? "FALSE" : "TRUE";
  592. $attrs = array(
  593. "zimbraAccountStatus"=>$status,
  594. "zimbraHideInGal"=>$hideInGAL,
  595. );
  596. $result = $this->modifyAccount($idOrNameAccount, $attrs, $type);
  597. return $result;
  598. }
  599. /**
  600. * expireAccountSessions
  601. * @param string $idOrNameAccount account id or account name
  602. * @param string $type value of the account (auto, name, id)
  603. * @return array informations
  604. */
  605. function expireAccountSessions($idOrNameAccount, $type = "auto")
  606. {
  607. $attrName = "zimbraAuthTokenValidityValue";
  608. $oldValue = $this->getAccountOption($idOrNameAccount, $attrName);
  609. $newValue = rand($oldValue+1, 1024);
  610. $attrs = array($attrName=>$newValue);
  611. $result = $this->modifyAccount($idOrNameAccount, $attrs, $type);
  612. return $result;
  613. }
  614. /**
  615. * getAccountCos
  616. * @param string $idOrNameAccount account id or account name
  617. * @param string $returnType get the COS ID or NAME
  618. * @param string $type value of the account (auto, name, id)
  619. * @return string COS id or name
  620. */
  621. function getAccountCos($idOrNameAccount, $returnType = "NAME", $type = "auto")
  622. {
  623. if($type == "auto")
  624. $realType = getAccountType($idOrNameAccount);
  625. else
  626. $realType = $type;
  627. if($realType == "name")
  628. $accountId = $this->getAccountId($idOrNameAccount);
  629. else
  630. $accountId = $idOrNameAccount;
  631. $result = null;
  632. $params = array(
  633. new SoapVar('<ns1:account by="' . $realType . '">' . $idOrNameAccount . '</ns1:account>', XSD_ANYXML),
  634. );
  635. try
  636. {
  637. $result = $this->auth->execSoapCall(
  638. "GetAccountInfoRequest",
  639. $params
  640. );
  641. $result = $result['SOAP:ENVELOPE']['SOAP:BODY']['GETACCOUNTINFORESPONSE']['COS'][$returnType];
  642. }
  643. catch (SoapFault $exception)
  644. {
  645. $result = $exception;
  646. }
  647. return $result;
  648. }
  649. /**
  650. * setAccountCos
  651. * @param string $idOrNameAccount account id or account name
  652. * @param string $cosName the COS name
  653. * @param string $type value of the account (auto, name, id)
  654. * @return array informations
  655. */
  656. function setAccountCos($idOrNameAccount, $cosName, $type = "auto")
  657. {
  658. $cosId = $this->getCosId($cosName);
  659. $attrs = array("zimbraCOSId"=>$cosId);
  660. $result = $this->modifyAccount($idOrNameAccount, $attrs, $type);
  661. return $result;
  662. }
  663. /**
  664. * getCosId
  665. * @param string $name the COS name
  666. * @return string COS id
  667. */
  668. function getCosId($name)
  669. {
  670. $result = null;
  671. $params = array(
  672. new SoapVar('<ns1:cos by="name">' . $name . '</ns1:cos>', XSD_ANYXML),
  673. );
  674. try
  675. {
  676. $result = $this->auth->execSoapCall(
  677. "GetCosRequest",
  678. $params
  679. );
  680. $result = $result['SOAP:ENVELOPE']['SOAP:BODY']['GETCOSRESPONSE']['COS']['ID'];
  681. }
  682. catch (SoapFault $exception)
  683. {
  684. $result = $exception;
  685. }
  686. return $result;
  687. }
  688. /**
  689. * getAllCos
  690. * @return array informations
  691. */
  692. function getAllCos()
  693. {
  694. $result = null;
  695. try
  696. {
  697. $result = $this->auth->execSoapCall(
  698. "GetAllCosRequest"
  699. );
  700. $result = $result['SOAP:ENVELOPE']['SOAP:BODY']['GETALLCOSRESPONSE'];
  701. }
  702. catch (SoapFault $exception)
  703. {
  704. $result = $exception;
  705. }
  706. return $result;
  707. }
  708. }
  709. ?>