|
@@ -10,6 +10,7 @@ use function ThurData\Servers\KerioEmail\Core\Helper\di;
|
|
|
use ThurData\Servers\KerioEmail\Core\Models\Whmcs\Hosting;
|
|
use ThurData\Servers\KerioEmail\Core\Models\Whmcs\Hosting;
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\ResponseTemplates\HtmlDataJsonResponse;
|
|
use ThurData\Servers\KerioEmail\Core\UI\ResponseTemplates\HtmlDataJsonResponse;
|
|
|
use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\DataProviders\BaseDataProvider;
|
|
use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\DataProviders\BaseDataProvider;
|
|
|
|
|
+use ThurData\Servers\KerioEmail\Api\KerioWhmcs;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
*
|
|
*
|
|
@@ -27,16 +28,49 @@ class AddListDataProvider extends BaseDataProvider
|
|
|
$hosting = Hosting::where('id', $this->getRequestValue('id'))->first();
|
|
$hosting = Hosting::where('id', $this->getRequestValue('id'))->first();
|
|
|
$this->data['domain'] = $hosting->domain;
|
|
$this->data['domain'] = $hosting->domain;
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * load api
|
|
|
|
|
- */
|
|
|
|
|
- $accounts = (new KerioManager())
|
|
|
|
|
- ->getApiByServer($hosting->server)
|
|
|
|
|
- ->soap
|
|
|
|
|
- ->repository()
|
|
|
|
|
- ->accounts
|
|
|
|
|
- ->getByDomainName($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']);
|
|
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'kerioEmail',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $error,
|
|
|
|
|
+ 'Debug Error',
|
|
|
|
|
+ $error->getMessage()
|
|
|
|
|
+ );
|
|
|
|
|
+ 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");
|
|
|
|
|
+ try {
|
|
|
|
|
+ $accounts = $api->getUsers($fields,$this->maildomainID);
|
|
|
|
|
+ } catch (KerioApiException $error) {
|
|
|
|
|
+ logModuleCall(
|
|
|
|
|
+ 'kerioEmail',
|
|
|
|
|
+ __FUNCTION__,
|
|
|
|
|
+ $error,
|
|
|
|
|
+ 'Debug Error',
|
|
|
|
|
+ $error->getMessage()
|
|
|
|
|
+ );
|
|
|
|
|
+ return ['error' => $error->getMessage()];
|
|
|
|
|
+ }
|
|
|
|
|
+ $api->logout();
|
|
|
|
|
|
|
|
|
|
+ foreach($accounts as $account)
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->availableValues['memberList'][$account['loginName']] = $account['loginName'];
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
*
|
|
*
|
|
@@ -49,7 +83,7 @@ class AddListDataProvider extends BaseDataProvider
|
|
|
*/
|
|
*/
|
|
|
$this->availableValues['subscriptionRequest'] = [
|
|
$this->availableValues['subscriptionRequest'] = [
|
|
|
Kerio::STATUS_ACCEPT => $lang->absoluteT('Automatically accept'),
|
|
Kerio::STATUS_ACCEPT => $lang->absoluteT('Automatically accept'),
|
|
|
- Kerio::STATUS_APPROVAL => $lang->absoluteT('Require list owner approval'),
|
|
|
|
|
|
|
+ Kerio::STATUS_APPROVAL => $lang->absoluteT('Require moderator approval'),
|
|
|
Kerio::STATUS_REJECT => $lang->absoluteT('Automatically reject')
|
|
Kerio::STATUS_REJECT => $lang->absoluteT('Automatically reject')
|
|
|
];
|
|
];
|
|
|
|
|
|
|
@@ -58,20 +92,10 @@ class AddListDataProvider extends BaseDataProvider
|
|
|
*/
|
|
*/
|
|
|
$this->availableValues['unsubscriptionRequest'] = [
|
|
$this->availableValues['unsubscriptionRequest'] = [
|
|
|
Kerio::STATUS_ACCEPT => $lang->absoluteT('Automatically accept'),
|
|
Kerio::STATUS_ACCEPT => $lang->absoluteT('Automatically accept'),
|
|
|
- Kerio::STATUS_APPROVAL => $lang->absoluteT('Require list owner approval'),
|
|
|
|
|
|
|
+ Kerio::STATUS_APPROVAL => $lang->absoluteT('Require moderator approval'),
|
|
|
Kerio::STATUS_REJECT => $lang->absoluteT('Automatically reject')
|
|
Kerio::STATUS_REJECT => $lang->absoluteT('Automatically reject')
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- *
|
|
|
|
|
- */
|
|
|
|
|
- foreach($accounts as $account)
|
|
|
|
|
- {
|
|
|
|
|
- $this->availableValues['memberList'][$account->getName()] = $account->getName();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if($this->formData)
|
|
if($this->formData)
|
|
|
{
|
|
{
|
|
|
$this->loadReloadedData();
|
|
$this->loadReloadedData();
|