Kaynağa Gözat

domainaliase

andre 2 yıl önce
ebeveyn
işleme
c4bbd931cb

+ 1 - 1
app/UI/Client/DistributionList/Providers/EditListDataProvider.php

@@ -332,7 +332,7 @@ class EditListDataProvider extends AddListDataProvider
                 return ['error' => $error->getMessage()];
             }
         }
-
+        $api->logout();
         return (new HtmlDataJsonResponse())->setMessageAndTranslate('distributionListHasBeenUpdated')->setStatusSuccess();
 
     }

+ 39 - 25
app/UI/Client/DomainAlias/Pages/DomainAliases.php

@@ -14,6 +14,7 @@ use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\Column;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\DataProviders\DataProvider;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\DataProviders\Providers\ArrayDataProvider;
 use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\DataTable;
+use ThurData\Servers\KerioEmail\Api\KerioWhmcs;
 
 /**
  *
@@ -51,23 +52,36 @@ class DomainAliases extends DataTable implements ClientArea
 
     public function loadData()
     {
-        /**
-         * load hosting
-         */
-        $hosting = Hosting::where('id', $this->getRequestValue('id'))->first();
 
-        /**
-         * load api client by server id
-         * get repo
-         * get aliases per domain
-         */
-        $aliases = (new KerioManager())
-            ->getApiByServer($hosting->server)
-            ->soap
-            ->repository()
-            ->domains
-            ->getAliases($hosting->domain);
+        $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
+        try {
+            $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
+            $domains = $api->getDomains(['id','name','aliasList']);
+        } catch (KerioApiException $error) {
+            logModuleCall(
+                'kerioEmail',
+                __FUNCTION__,
+                $error,
+                'Debug Error',
+                $error->getMessage()
+            );
+            return ['error' => $error->getMessage()];
+        }
+        foreach($domains as $domain) {
+            if(($domain['name']) === $this->getWhmcsParamByKey('domain')){ 
+                $this->domainID = $domain['id'];
+                $this->domainName = $domain['name'];
+                $this->aliasList = $domain['name'];
+            }
+        }
 
+        logModuleCall(
+            'kerioEmail',
+            __FUNCTION__,
+            $domains,
+            'Debug Error',
+            $this->aliasList
+        );
 
         /**
          *
@@ -78,17 +92,17 @@ class DomainAliases extends DataTable implements ClientArea
         /**
          * parse aliases
          */
-        foreach ($aliases as $domain)
-        {
-            /* @var $domain Domain */
-            $tmp = [
-                'id'    => $domain->getId(),
-                'name'  => $domain->getName(),
-                'description' => $domain->getAttr(Domain::ATTR_DESCRIPTION)
-            ];
+//        foreach ($aliases as $alias)
+//        {
+            /* @var $alias Alias */
+//            $tmp = [
+//                'id'    => $alias['id'],
+//                'name'  => $alias['name'],
+//                'description' => $alias['description']
+//            ];
 
-            $data[] = $tmp;
-        }
+//            $data[] = $tmp;
+ //       }
 
         $dataProv = new ArrayDataProvider();
         $dataProv->setDefaultSorting('name', 'ASC')->setData($data);