|
|
@@ -25,12 +25,12 @@ class EditSettingDataProvider extends BaseDataProvider
|
|
|
public function read()
|
|
|
{
|
|
|
$fields = array(
|
|
|
- "id",
|
|
|
- "name",
|
|
|
- "description",
|
|
|
- "type",
|
|
|
- "isEnabled",
|
|
|
- "manager"
|
|
|
+ 'id',
|
|
|
+ "domain",
|
|
|
+ "test",
|
|
|
+ "notes",
|
|
|
+ "2FA",
|
|
|
+ "AD"
|
|
|
);
|
|
|
$cond = array(
|
|
|
"fieldName" => "id",
|
|
|
@@ -38,58 +38,7 @@ class EditSettingDataProvider extends BaseDataProvider
|
|
|
"value" => $this->actionElementId
|
|
|
);
|
|
|
|
|
|
- $api = new KerioWhmcs('whmcsKerioEmail', 'Thurdata', '1.0');
|
|
|
- try {
|
|
|
- $api->login($this->getWhmcsParamByKey('serverhostname'), $this->getWhmcsParamByKey('serverusername'), $this->getWhmcsParamByKey('serverpassword'));
|
|
|
- $domainID = $api->getDomainId($this->getWhmcsParamByKey('domain'));
|
|
|
- } catch (KerioApiException $error) {
|
|
|
- logModuleCall(
|
|
|
- 'kerioEmail',
|
|
|
- __FUNCTION__,
|
|
|
- $error,
|
|
|
- 'Debug Error',
|
|
|
- $error->getMessage()
|
|
|
- );
|
|
|
- return ['error' => $error->getMessage()];
|
|
|
- }
|
|
|
- try {
|
|
|
- $ressource = $api->getResources($fields,$domainID,[ $cond ]);
|
|
|
- } catch (KerioApiException $error) {
|
|
|
- logModuleCall(
|
|
|
- 'kerioEmail',
|
|
|
- __FUNCTION__,
|
|
|
- $error,
|
|
|
- 'Debug Error',
|
|
|
- $error->getMessage()
|
|
|
- );
|
|
|
- return ['error' => $error->getMessage()];
|
|
|
- }
|
|
|
- $attr = array(
|
|
|
- "id",
|
|
|
- "loginName",
|
|
|
- "isEnabled");
|
|
|
- try {
|
|
|
- $users = $api->getUsers($attr,$domainID);
|
|
|
- } catch (KerioApiException $error) {
|
|
|
- logModuleCall(
|
|
|
- 'kerioEmail',
|
|
|
- __FUNCTION__,
|
|
|
- $error,
|
|
|
- 'Debug Error',
|
|
|
- $error->getMessage()
|
|
|
- );
|
|
|
- return ['error' => $error->getMessage()];
|
|
|
- }
|
|
|
- $api->logout();
|
|
|
$this->availableValues['manager'][$ressource[0]['manager']['id']] = $ressource[0]['manager']['name'] . '@' . $ressource[0]['manager']['domainName'];
|
|
|
- foreach($users as $user) {
|
|
|
- if($user['isEnabled']){
|
|
|
- $this->availableValues['manager'][ $user['id']] = $user['loginName'] . '@' . $this->getWhmcsParamByKey('domain');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $lang = di('lang');
|
|
|
- $this->data['id'] = $ressource[0]['id'];
|
|
|
$this->data['name'] = $ressource[0]['name'];
|
|
|
$this->data['domain'] = $this->getWhmcsParamByKey('domain');
|
|
|
$this->data['status'] = $ressource[0]['isEnabled'] == true ? Kerio::ACC_STATUS_ACTIVE : Kerio::ACC_STATUS_CLOSED;
|