瀏覽代碼

debug accountInfo

andre 5 年之前
父節點
當前提交
a5ae9ccec8
共有 2 個文件被更改,包括 45 次插入4 次删除
  1. 30 0
      api/Zm/Account.php
  2. 15 4
      zimbraSingle.inc

+ 30 - 0
api/Zm/Account.php

@@ -134,6 +134,36 @@ class Zm_Account
 		return $result;
 	}
 
+	/**
+	 * getAccount
+	 * @param string $name account name
+	 * @return string account
+	 */
+	function getAccount($name)
+	{
+		$result = null;
+
+		$params = array(
+			new SoapVar('<ns1:account by="name">' . $name . '</ns1:account>', XSD_ANYXML),
+		);
+
+		try
+		{
+			$result = $this->auth->execSoapCall(
+				"GetAccountRequest",
+				$params
+			);
+
+			$result = getSoapAttribute($result['SOAP:ENVELOPE']['SOAP:BODY']['GETACCOUNTINFORESPONSE'];
+		}
+		catch (SoapFault $exception)
+		{
+			$result = $exception;
+		}
+
+		return $result;
+	}
+
 	/**
 	 * getAccountId
 	 * @param string $name account name

+ 15 - 4
zimbraSingle.inc

@@ -352,13 +352,13 @@ function zimbraSingleClientArea($userData)
         return false;
     }
     $apiAccountManager = new Zm_Account($api);
-    $response = $apiAccountManager->getAccountInfo($account_name);
+    $response = $apiAccountManager->getAccount($account_name);
     if(is_a($response, "Exception")) {
         logModuleCall(
             'zimbrasingle',
             __FUNCTION__,
             $params,
-            "Error : could not gather informations for  $account_name",
+            "Error : could not find $account_name",
             ""
         );
         return false;
@@ -368,10 +368,21 @@ function zimbraSingleClientArea($userData)
         'zimbrasingle',
         __FUNCTION__,
         $params,
-        "devug: clientarea",
+        "debug: getAccount",
         $response
     );
-
+    
+    $response = $apiAccountManager->getAccountInfo($account_name);
+    if(is_a($response, "Exception")) {
+        logModuleCall(
+            'zimbrasingle',
+            __FUNCTION__,
+            $params,
+            "Error : could not gather informations for  $account_name",
+            ""
+        );
+        return false;
+    }
     $webMailURL = recursiveFindAll( $response, 'PUBLICMAILURL');
     return $webMailURL;
 }