refractoring

This commit is contained in:
Guillaume ARNOUX 2024-01-27 19:01:45 +01:00
parent e0efabc605
commit 759d73ec0e

View file

@ -161,14 +161,15 @@ class Server_Manager_Mailcow extends Server_Manager
"description" => $a->getDomain() . " domain", "description" => $a->getDomain() . " domain",
"domain" => $a->getDomain(), "domain" => $a->getDomain(),
"mailboxes" => $p->getMaxPop(), "mailboxes" => $p->getMaxPop(),
"maxquota" => "10240", "maxquota" => $p->getCustomValue('maxquota'),
"quota" => "10240", "quota" => $p->getCustomValue('maxquota'),
"relay_all_recipients" => "0", "relay_all_recipients" => "0",
"rl_frame" => "h", "rl_frame" => "h",
"rl_value" => "200", "rl_value" => $p->getCustomValue('ratelimit'),
"restart_sogo" => "10", "restart_sogo" => "10",
] ]
]; ];
// Create domain on mailcow // Create domain on mailcow
$result1 = $this->_makeRequest('POST', 'add/domain', $domainData); $result1 = $this->_makeRequest('POST', 'add/domain', $domainData);
if (str_contains($result1, 'success')) { if (str_contains($result1, 'success')) {
@ -179,7 +180,7 @@ class Server_Manager_Mailcow extends Server_Manager
"domains" => $a->getDomain(), "domains" => $a->getDomain(),
"password" => $a->getPassword(), "password" => $a->getPassword(),
"password2" => $a->getPassword(), "password2" => $a->getPassword(),
"username" => "adm_" . str_replace(".", "", $a->getDomain()) "username" => $this->generateUsername($a->getDomain())
] ]
]; ];
$result2 = $this->_makeRequest('POST', 'add/domain-admin', $domainAdminData); $result2 = $this->_makeRequest('POST', 'add/domain-admin', $domainAdminData);
@ -189,7 +190,7 @@ class Server_Manager_Mailcow extends Server_Manager
$domainAclData = [ $domainAclData = [
'json' => [ 'json' => [
"items" => [ "items" => [
"adm_" . str_replace(".", "", $a->getDomain()) $this->generateUsername($a->getDomain())
], ],
"attr" => [ "attr" => [
"da_acl" => [ "da_acl" => [
@ -294,7 +295,7 @@ class Server_Manager_Mailcow extends Server_Manager
// Delete Domain Admin in mailcow // Delete Domain Admin in mailcow
$domainAdminData = [ $domainAdminData = [
'json' => [ 'json' => [
"adm_" . str_replace(".", "", $a->getDomain()), $this->generateUsername($a->getDomain()),
] ]
]; ];
/* /*
@ -367,7 +368,7 @@ class Server_Manager_Mailcow extends Server_Manager
$domainAdminData = [ $domainAdminData = [
'json' => [ 'json' => [
"items" => [ "items" => [
"adm_" . str_replace(".", "", $a->getDomain()) $this->generateUsername($a->getDomain())
], ],
"attr" => [ "attr" => [
"password" => $new, "password" => $new,