move email settings to the top and hide then optional domain-settings when adding/editing domain as admin; fixes #1012

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-03-15 09:05:05 +01:00
parent af6b5f0ec5
commit 0d282d29d8
7 changed files with 99 additions and 69 deletions

View File

@@ -68,7 +68,12 @@ class Domain
public static function canViewLogs(array $attributes): bool
{
return (bool)UI::getCurrentUser()['logviewenabled'];
if ((int) UI::getCurrentUser()['adminsession'] == 0 && (bool)UI::getCurrentUser()['logviewenabled']) {
return true;
} elseif ((int) UI::getCurrentUser()['adminsession'] == 1 && (int)$attributes['fields']['email_only'] == 0) {
return true;
}
return false;
}
public static function canDelete(array $attributes): bool
@@ -102,7 +107,7 @@ class Domain
public static function hasLetsEncryptActivated(array $attributes): bool
{
return (bool) $attributes['fields']['letsencrypt'];
return ((bool) $attributes['fields']['letsencrypt'] && (int)$attributes['fields']['email_only'] == 0);
}
public static function canEditSSL(array $attributes): bool
@@ -110,8 +115,9 @@ class Domain
if (
Settings::Get('system.use_ssl') == '1'
&& DDomain::domainHasSslIpPort($attributes['fields']['id'])
&& $attributes['fields']['caneditdomain'] == '1'
&& $attributes['fields']['letsencrypt'] == 0
&& (int)$attributes['fields']['caneditdomain'] == 1
&& (int)$attributes['fields']['letsencrypt'] == 0
&& (int)$attributes['fields']['email_only'] == 0
) {
return true;
}