|
|
@@ -28,6 +28,7 @@ use ThurData\Servers\KerioEmail\Core\UI\Widget\DataTable\DataProviders\DataProvi
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\Interfaces\ClientArea;
|
|
|
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;
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
@@ -155,32 +156,38 @@ class Accounts extends DataTable implements ClientArea
|
|
|
*/
|
|
|
$hosting = Hosting::where('id', $this->getRequestValue('id'))->first();
|
|
|
|
|
|
-
|
|
|
- $accounts = (new KerioManager())
|
|
|
- ->getApiByServer($hosting->server)
|
|
|
- ->soap
|
|
|
- ->repository()
|
|
|
- ->accounts
|
|
|
- ->getByDomainName($hosting->domain);
|
|
|
+ $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
+ try {
|
|
|
+ $api->login($params['serverhostname'], $params['serverusername'], $params['serverpassword']);
|
|
|
+ $domains = $api->getDomains(['id','name']);
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $error,
|
|
|
+ 'Debug Error',
|
|
|
+ $error->getMessage()
|
|
|
+ );
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
+ }
|
|
|
+ logModuleCall(
|
|
|
+ 'kerioEmail',
|
|
|
+ __FUNCTION__,
|
|
|
+ $params,
|
|
|
+ 'Debug Accounts',
|
|
|
+ $domains
|
|
|
+ );
|
|
|
+ $api->logout();
|
|
|
|
|
|
$productManager = new ProductManager();
|
|
|
$productManager->loadByHostingId($hosting->id);
|
|
|
|
|
|
- if($productManager->get('filterAccountsByCOS') === 'on' && $productManager->get('cos_name') != ClassOfServices::CUSTOM_KERIO)
|
|
|
- {
|
|
|
- $availableCoses = is_array($productManager->getSettingCos()) ? array_keys($productManager->getSettingCos()) : [$productManager->getSettingCos()];
|
|
|
- $filter = new FilterByCosId();
|
|
|
- $filter->setAvailableCoses($availableCoses);
|
|
|
- $accounts = $filter->filter($accounts);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* format model to array
|
|
|
*/
|
|
|
$data = [];
|
|
|
- foreach ($accounts as $account)
|
|
|
+/* foreach ($accounts as $account)
|
|
|
{
|
|
|
- /* @var $account Account */
|
|
|
|
|
|
$accountArray = [
|
|
|
'id' => $account->getId(),
|
|
|
@@ -193,7 +200,7 @@ class Accounts extends DataTable implements ClientArea
|
|
|
];
|
|
|
|
|
|
$data[] = $accountArray;
|
|
|
- }
|
|
|
+ } */
|
|
|
$dataProv = new ArrayDataProvider();
|
|
|
$dataProv->setDefaultSorting('mailbox', 'ASC')->setData($data);
|
|
|
|