Browse Source

fixes & features

andre 5 years ago
parent
commit
e8e50e1273
8 changed files with 80 additions and 1 deletions
  1. 24 0
      api/Zm/Account.php
  2. 0 0
      api/Zm/Auth.php
  3. 0 0
      api/Zm/Domain.php
  4. 0 0
      api/Zm/Server.php
  5. 0 0
      api/Zm/User.php
  6. 0 0
      api/Zm/utils.php
  7. 46 0
      zimbraSingle.inc
  8. 10 1
      zimbraSingle.php

+ 24 - 0
api/zm/Account.php → api/Zm/Account.php

@@ -746,6 +746,30 @@ class Zm_Account
 
 		return $result;
 	}
+
+	/**
+	 * getAllCos
+	 * @return array informations
+	 */
+	function getAllCos()
+	{
+		$result = null;
+
+		try
+		{
+			$result = $this->auth->execSoapCall(
+				"GetAllCosRequest"
+			);
+
+			$result = $result['SOAP:ENVELOPE']['SOAP:BODY']['GETALLCOSRESPONSE'];
+		}
+		catch (SoapFault $exception)
+		{
+			$result = $exception;
+		}
+
+		return $result;
+	}
 }
 
 ?>

+ 0 - 0
api/zm/Auth.php → api/Zm/Auth.php


+ 0 - 0
api/zm/Domain.php → api/Zm/Domain.php


+ 0 - 0
api/zm/Server.php → api/Zm/Server.php


+ 0 - 0
api/zm/User.php → api/Zm/User.php


+ 0 - 0
api/zm/utils.php → api/Zm/utils.php


+ 46 - 0
zimbraSingle.inc

@@ -344,6 +344,52 @@ function zimbraSingleClientArea($userData)
     return $webMailURL[0]['DATA'];
 }
 
+function zimbraSingleConfigOptions() {
+    $accessData = zimbraSingleGetAccess();
+
+    $api = new Zm_Auth($accessData['zimbraServer'], $accessData['adminUser'], $accessData['adminPass'], "admin");
+    $login = $api->login();
+    if(is_a($login, "Exception")) {
+        logModuleCall(
+            'zimbrasingle',
+            __FUNCTION__,
+            $params,
+            "Error : cannot login to " . $accessData['zimbraServer'],
+            ""
+        );
+        return false;
+    }
+    $apiAccountManager = new Zm_Account($api);
+    $response = $apiAccountManager->getAllCos();
+    if(is_a($response, "Exception")) {
+        logModuleCall(
+            'zimbrasingle',
+            __FUNCTION__,
+            $params,
+            "Error : class of service for $account_name could not be set",
+            ""
+        );
+        return false;
+    }
+    logModuleCall(
+        'zimbrasingle',
+        __FUNCTION__,
+        $params,
+        "All COS Array",
+        $response
+    );
+    $configOptions = array (
+        "test" => [
+            "FriendlyName" => "Test",
+            "Type" => "text", # Text Box
+            "Size" => "25", # Defines the Field Width
+            "Description" => "Textbox",
+            "Default" => "Example",
+        ],
+    );
+    return $configOptions;
+}
+
 function zimbraSingleCheckPassword($pwd)
 {
     $message = '';

+ 10 - 1
zimbraSingle.php

@@ -105,7 +105,16 @@ function zimbraSingle_ChangePackage($params)
     if($response) {
         return 'success';
     }
-    return 'Error deleting account';
+    return 'Error changing package';
+}
+
+function zimbraSingle_ConfigOptions()
+{
+    $response = zimbraSingle_ConfigOptions();
+    if($response) {
+        return $response;
+    }
+    return 'Error setting config options';
 }
 
 function zimbraSingle_genUsername($name)