andre 5 лет назад
Родитель
Сommit
49741dd191
2 измененных файлов с 37 добавлено и 36 удалено
  1. 36 28
      zimbraSingle.inc
  2. 1 8
      zimbraSingle.php

+ 36 - 28
zimbraSingle.inc

@@ -213,6 +213,15 @@ function zimbraSingleUnsuspendAccount($userData)
 function zimbraSingleDeleteAccount($userData)
 {
     $accessData = zimbraSingleGetAccess();
+
+    logModuleCall(
+        'zimbrasingle',
+        __FUNCTION__,
+        $params,
+        "debug: accessdata",
+        $accessData
+        );
+
     $account_name = $userData['username'] . '@' . $userData['maildomain'];
 
     $api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
@@ -226,35 +235,34 @@ function zimbraSingleDeleteAccount($userData)
             ""
         );
         return false;
-    } else {
-        $apiAccountManager = new Zm_Account($api);
-        $response = $apiAccountManager->getAccountStatus($account_name);
-        if(is_a($response, "Exception")) {
-            logModuleCall(
-                'zimbrasingle',
-                __FUNCTION__,
-                $params,
-                "Error : account $account_name could not verified",
-                ""
-            );
-            return false;
-        }
-        if ($response != 'locked') {
-            return "Account $account_name active, suspend account first";
-        }
-        $response = $apiAccountManager->deleteAccount($account_name);
-        if(is_a($response, "Exception")) {
-            logModuleCall(
-                'zimbrasingle',
-                __FUNCTION__,
-                $params,
-                "Error : account $account_name could not removed",
-                ""
-            );
-            return false;
-        }
-        return 'success';
     }
+    $apiAccountManager = new Zm_Account($api);
+    $response = $apiAccountManager->getAccountStatus($account_name);
+    if(is_a($response, "Exception")) {
+        logModuleCall(
+            'zimbrasingle',
+            __FUNCTION__,
+            $params,
+            "Error : account $account_name could not verified",
+            ""
+        );
+        return false;
+    }
+    if ($response != 'locked') {
+        return "Account $account_name active, suspend account first";
+    }
+    $response = $apiAccountManager->deleteAccount($account_name);
+    if(is_a($response, "Exception")) {
+        logModuleCall(
+        'zimbrasingle',
+        __FUNCTION__,
+        $params,
+        "Error : account $account_name could not removed",
+        ""
+        );
+        return false;
+    }
+    return 'success';
 }
 
 function zimbraSingleChangePassword($userData) {

+ 1 - 8
zimbraSingle.php

@@ -65,14 +65,7 @@ function zimbraSingle_ChangePassword($params)
 
 function zimbraSingle_CreateAccount($params)
 {
-    logModuleCall(
-        'zimbrasingle',
-        __FUNCTION__,
-        $params,
-        "debug: params",
-        $params
-    );
-$response = zimbraSingleCreateAccount($params['customfields']);
+    $response = zimbraSingleCreateAccount($params['customfields']);
     if($response) {
         return 'success';
     }