|
|
@@ -2,27 +2,19 @@
|
|
|
|
|
|
namespace ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Pages;
|
|
|
|
|
|
-use ThurData\Servers\KerioEmail\App\Helpers\BuildUrlExtended;
|
|
|
-use ThurData\Servers\KerioEmail\App\Helpers\KerioManager;
|
|
|
use ThurData\Servers\KerioEmail\App\Libs\Product\ProductManager;
|
|
|
-use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Connection;
|
|
|
use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Helpers\AccountHelper;
|
|
|
-use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\Account;
|
|
|
-use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Repository\ClassOfServices;
|
|
|
-use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Filters\EmailAccounts\FilterByCosId;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Fields\EnabledField;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Buttons\AddAccountButton;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Buttons\ChangePasswordButton;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Buttons\ChangeStatusButton;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Buttons\DeleteAccountButton;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Buttons\EditAccountButton;
|
|
|
-use ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Buttons\LoginToPanelButton;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Buttons\MassChangeStatusButton;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Buttons\MassDeleteAccountButton;
|
|
|
use ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Buttons\SpanDropdownButton;
|
|
|
use function ThurData\Servers\KerioEmail\Core\Helper\di;
|
|
|
use ThurData\Servers\KerioEmail\Core\Models\Whmcs\Hosting;
|
|
|
-use ThurData\Servers\KerioEmail\Core\UI\Widget\Buttons\DropdawnButtonWrappers\ButtonDropdown;
|
|
|
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\Interfaces\ClientArea;
|
|
|
@@ -46,11 +38,7 @@ class Accounts extends DataTable implements ClientArea
|
|
|
*/
|
|
|
const STATUS_LABEL = [
|
|
|
'active' => 'success',
|
|
|
- 'locked' => 'default',
|
|
|
- 'maintenance' => 'warning',
|
|
|
'closed' => 'default',
|
|
|
- 'lockout' => 'info',
|
|
|
- 'pending' => 'warning',
|
|
|
'default' => 'default'
|
|
|
];
|
|
|
|
|
|
@@ -114,9 +102,6 @@ class Accounts extends DataTable implements ClientArea
|
|
|
public function initContent()
|
|
|
{
|
|
|
|
|
|
- $productManager = new ProductManager();
|
|
|
- $productManager->loadByHostingId($this->getRequestValue('id'));
|
|
|
-
|
|
|
$this->addMassActionButton(new MassChangeStatusButton());
|
|
|
$this->addMassActionButton(new MassDeleteAccountButton());
|
|
|
|
|
|
@@ -139,14 +124,11 @@ class Accounts extends DataTable implements ClientArea
|
|
|
*/
|
|
|
public function loadData()
|
|
|
{
|
|
|
- /**
|
|
|
- * load hosting
|
|
|
- */
|
|
|
- $hosting = Hosting::where('id', $this->getRequestValue('id'))->first();
|
|
|
+ $domain = $this->getWhmcsParamByKey('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']);
|
|
|
+ $domainID = $api->getDomainId($domain);
|
|
|
} catch (KerioApiException $error) {
|
|
|
logModuleCall(
|
|
|
'kerioEmail',
|
|
|
@@ -157,14 +139,6 @@ class Accounts extends DataTable implements ClientArea
|
|
|
);
|
|
|
return ['error' => $error->getMessage()];
|
|
|
}
|
|
|
- foreach($domains as $maildomain) {
|
|
|
- if(($maildomain['name']) === $this->getWhmcsParamByKey('domain')){
|
|
|
- $this->maildomainID = $maildomain['id'];
|
|
|
- $this->maildomain = $maildomain['name'];
|
|
|
- }
|
|
|
- }
|
|
|
- $productManager = new ProductManager();
|
|
|
- $productManager->loadByHostingId($hosting->id);
|
|
|
$fields = array(
|
|
|
"id",
|
|
|
"loginName",
|
|
|
@@ -173,7 +147,7 @@ class Accounts extends DataTable implements ClientArea
|
|
|
"consumedSize",
|
|
|
"lastLoginInfo");
|
|
|
try {
|
|
|
- $accounts = $api->getUsers($fields,$this->maildomainID);
|
|
|
+ $accounts = $api->getUsers($fields,$domainID);
|
|
|
} catch (KerioApiException $error) {
|
|
|
logModuleCall(
|
|
|
'kerioEmail',
|
|
|
@@ -192,7 +166,7 @@ class Accounts extends DataTable implements ClientArea
|
|
|
|
|
|
$accountArray = [
|
|
|
'id' => $account['id'],
|
|
|
- 'mailbox' => $account['loginName'] . '@' . $this->maildomain,
|
|
|
+ 'mailbox' => $account['loginName'] . '@' . $domain,
|
|
|
'last_login' => AccountHelper::getFormattedData($account['lastLoginInfo']['dateTime'], 'd/m/Y H:i'),
|
|
|
'size' => AccountHelper::getQuotaAsMb($account['consumedSize']['value'],$account['consumedSize']['unit']),
|
|
|
'quota' => $account['diskSizeLimit']['isActive'] ? AccountHelper::getQuotaAsMb($account['diskSizeLimit']['limit']['value'],$account['diskSizeLimit']['limit']['units']) : '∞',
|