|
|
@@ -19,7 +19,7 @@ class ListAccounts extends AddonController
|
|
|
$api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
try {
|
|
|
$api->login($params['serverhostname'], $params['serverusername'], $params['serverpassword']);
|
|
|
- $domainID = $api->getDomainId($params['domain']);
|
|
|
+ $domains = $api->getDomains(['id','name']);
|
|
|
} catch (KerioApiException $error) {
|
|
|
logModuleCall(
|
|
|
'kerioEmail',
|
|
|
@@ -29,26 +29,23 @@ class ListAccounts extends AddonController
|
|
|
$error->getMessage()
|
|
|
);
|
|
|
return ['error' => $error->getMessage()];
|
|
|
- }
|
|
|
- if ($domainID === FALSE) {
|
|
|
- return "Error: Domain $domain not found";
|
|
|
}
|
|
|
- try {
|
|
|
- $users = $api->getUsers(['loginName'], $domainID);
|
|
|
- } catch (KerioApiException $error) {
|
|
|
- logModuleCall(
|
|
|
- 'kerioEmail',
|
|
|
- __FUNCTION__,
|
|
|
- $users,
|
|
|
- 'Debug Userlist',
|
|
|
- $domainID
|
|
|
- );
|
|
|
- return ['error' => $error->getMessage()];
|
|
|
- }
|
|
|
+ $api->logout();
|
|
|
+ $accounts = [];
|
|
|
+ foreach($domains as $domain) {
|
|
|
+ $accounts[] = [
|
|
|
+ 'domain' => $domain,
|
|
|
+ 'status' => 'Active',
|
|
|
+ 'primaryip' => $params['serverip'],
|
|
|
+ 'uniqueIdentifier' => $params['serverhostname'],
|
|
|
+ 'product' => '',
|
|
|
+ ];
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
return [
|
|
|
'success' => true,
|
|
|
- 'accounts' => $users
|
|
|
+ 'accounts' => $accounts
|
|
|
];
|
|
|
|
|
|
}
|