more integration of domain deactivated flag

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2023-06-06 14:10:07 +02:00
parent 6e37b55ac6
commit 03257f04cb
4 changed files with 11 additions and 7 deletions

View File

@@ -1892,8 +1892,8 @@ class Domains extends ApiCommand implements ResourceEntity
if ($deactivated != $result['deactivated']) { if ($deactivated != $result['deactivated']) {
// deactivate email accounts // deactivate email accounts
$yesno = ($deactivated ? 'N' : 'Y'); $yesno = ($deactivated ? 'N' : 'Y');
$pop3 = ($deactivated ? '0' : (int)$result['pop3']); $pop3 = ($deactivated ? '0' : (int)$customer['pop3']);
$imap = ($deactivated ? '0' : (int)$result['imap']); $imap = ($deactivated ? '0' : (int)$customer['imap']);
$upd_stmt = Database::prepare(" $upd_stmt = Database::prepare("
UPDATE `" . TABLE_MAIL_USERS . "` UPDATE `" . TABLE_MAIL_USERS . "`

View File

@@ -95,9 +95,13 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
$customer = $this->getCustomerData('email_accounts'); $customer = $this->getCustomerData('email_accounts');
// check for imap||pop3 == 1, see #1298 // check for imap||pop3 == 1, see #1298
// d00p, 6.5.2023 @revert this - if a customer has resources which allow email accounts
// it implicitly allowed SMTP, e.g. sending of emails which also requires an account to exist
/*
if ($customer['imap'] != '1' && $customer['pop3'] != '1') { if ($customer['imap'] != '1' && $customer['pop3'] != '1') {
Response::standardError('notallowedtouseaccounts', '', true); Response::standardError('notallowedtouseaccounts', '', true);
} }
*/
if (!empty($emailaddr)) { if (!empty($emailaddr)) {
$idna_convert = new IdnaWrapper(); $idna_convert = new IdnaWrapper();

View File

@@ -60,18 +60,18 @@ class Style
$today = time(); $today = time();
$termination_css = 'bg-warning'; $termination_css = 'bg-warning';
if ($cdate < $today) { if ($cdate < $today) {
$termination_css = 'bg-danger'; $termination_css = 'bg-danger text-light';
} }
} }
$deactivated = $attributes['fields']['deactivated'] || $attributes['fields']['customer_deactivated']; $deactivated = $attributes['fields']['deactivated'] || $attributes['fields']['customer_deactivated'];
return $deactivated ? 'bg-info' : $termination_css; return $deactivated ? 'bg-info text-light' : $termination_css;
} }
public static function resultCustomerLockedOrDeactivated(array $attributes): string public static function resultCustomerLockedOrDeactivated(array $attributes): string
{ {
$row_css = ''; $row_css = '';
if ((int)$attributes['fields']['deactivated'] == 1) { if ((int)$attributes['fields']['deactivated'] == 1) {
$row_css = 'bg-info'; $row_css = 'bg-info text-light';
} elseif ( } elseif (
$attributes['fields']['loginfail_count'] >= Settings::Get('login.maxloginattempts') $attributes['fields']['loginfail_count'] >= Settings::Get('login.maxloginattempts')
&& $attributes['fields']['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime')) && $attributes['fields']['lastlogin_fail'] > (time() - Settings::Get('login.deactivatetime'))

View File

@@ -186,7 +186,7 @@ return [
'url' => 'admin_customers.php?page=customers', 'url' => 'admin_customers.php?page=customers',
'label' => lng('admin.customers'), 'label' => lng('admin.customers'),
'required_resources' => 'customers', 'required_resources' => 'customers',
'add_shortlink' => CurrentUser::canAddResource('customers') ? 'admin_customers.php?page=customers&action=add' : null, 'add_shortlink' => CurrentUser::isAdmin() && CurrentUser::canAddResource('customers') ? 'admin_customers.php?page=customers&action=add' : null,
], ],
[ [
'url' => 'admin_admins.php?page=admins', 'url' => 'admin_admins.php?page=admins',
@@ -198,7 +198,7 @@ return [
'url' => 'admin_domains.php?page=domains', 'url' => 'admin_domains.php?page=domains',
'label' => lng('admin.domains'), 'label' => lng('admin.domains'),
'required_resources' => 'domains', 'required_resources' => 'domains',
'add_shortlink' => CurrentUser::canAddResource('domains') ? 'admin_domains.php?page=domains&action=add' : null, 'add_shortlink' => CurrentUser::isAdmin() && CurrentUser::canAddResource('domains') ? 'admin_domains.php?page=domains&action=add' : null,
], ],
[ [
'url' => 'admin_domains.php?page=sslcertificates', 'url' => 'admin_domains.php?page=sslcertificates',