From f4eaaf3d091488e0ec123fdd5e492655224ae44a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 12 Jul 2017 18:42:30 +0200 Subject: [PATCH] * Admin/EMail: allow admins to always add arbitrary aliases, even if not allowed for regular user --- admin/inc/class.admin_mail.inc.php | 27 ++++++++++++++++--------- admin/templates/default/mailaccount.xet | 4 ++-- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/admin/inc/class.admin_mail.inc.php b/admin/inc/class.admin_mail.inc.php index 0ddb756cc6..52d574e49c 100644 --- a/admin/inc/class.admin_mail.inc.php +++ b/admin/inc/class.admin_mail.inc.php @@ -1200,16 +1200,6 @@ class admin_mail $sel_options['acc_id'] = $content['accounts']; $sel_options['acc_further_identities'] = self::$further_identities; - // if only aliases are allowed for futher identities, add them as options - if ($content['acc_further_identities'] == 2) - { - $sel_options['ident_email_alias'] = array_merge( - array('' => $content['mailLocalAddress'].' ('.lang('Default').')'), - array_combine($content['mailAlternateAddress'], $content['mailAlternateAddress'])); - // copy ident_email to select-box ident_email_alias, as et2 requires unique ids - $content['ident_email_alias'] = $content['ident_email']; - } - // user is allowed to create or edit further identities if ($edit_access || $content['acc_further_identities']) { @@ -1251,6 +1241,23 @@ class admin_mail } $content['old_acc_id'] = $content['acc_id']; + // if only aliases are allowed for futher identities, add them as options + // allow admins to always add arbitrary aliases + if ($content['acc_further_identities'] == 2 && !$this->is_admin) + { + $sel_options['ident_email_alias'] = array_merge( + array('' => $content['mailLocalAddress'].' ('.lang('Default').')'), + array_combine($content['mailAlternateAddress'], $content['mailAlternateAddress'])); + // if admin explicitly set a non-alias, we need to add it to aliases to keep it after storing signature by user + if ($content['ident_email'] !== $content['mailLocalAddress'] && !isset($sel_options['ident_email_alias'][$content['ident_email']])) + { + $sel_options['ident_email_alias'][$content['ident_email']] = $content['ident_email']; + } + // copy ident_email to select-box ident_email_alias, as et2 requires unique ids + $content['ident_email_alias'] = $content['ident_email']; + $content['select_ident_mail'] = true; + } + // only allow to delete further identities, not a standard identity $readonlys['button[delete_identity]'] = !($content['ident_id'] > 0 && $content['ident_id'] != $content['std_ident_id']); diff --git a/admin/templates/default/mailaccount.xet b/admin/templates/default/mailaccount.xet index 6e13291232..597330a8cc 100644 --- a/admin/templates/default/mailaccount.xet +++ b/admin/templates/default/mailaccount.xet @@ -30,11 +30,11 @@ - + - +