* Admin/EMail: allow admins to always add arbitrary aliases, even if not allowed for regular user

This commit is contained in:
Ralf Becker 2017-07-12 18:42:30 +02:00
parent 9eb877eb3b
commit f4eaaf3d09
2 changed files with 19 additions and 12 deletions

View File

@ -1200,16 +1200,6 @@ class admin_mail
$sel_options['acc_id'] = $content['accounts']; $sel_options['acc_id'] = $content['accounts'];
$sel_options['acc_further_identities'] = self::$further_identities; $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 // user is allowed to create or edit further identities
if ($edit_access || $content['acc_further_identities']) if ($edit_access || $content['acc_further_identities'])
{ {
@ -1251,6 +1241,23 @@ class admin_mail
} }
$content['old_acc_id'] = $content['acc_id']; $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 // 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']); $readonlys['button[delete_identity]'] = !($content['ident_id'] > 0 && $content['ident_id'] != $content['std_ident_id']);

View File

@ -30,11 +30,11 @@
<description for="ident_org" value="Organisation"/> <description for="ident_org" value="Organisation"/>
<textbox id="ident_org" size="90" maxlength="128" span="all"/> <textbox id="ident_org" size="90" maxlength="128" span="all"/>
</row> </row>
<row disabled="@acc_further_identities=2"> <row disabled="@select_ident_mail">
<description for="ident_email" value="EMail address"/> <description for="ident_email" value="EMail address"/>
<url-email id="ident_email" size="90" maxlength="128" span="all"/> <url-email id="ident_email" size="90" maxlength="128" span="all"/>
</row> </row>
<row disabled="!@acc_further_identities=2"> <row disabled="!@select_ident_mail">
<description for="ident_email_alias" value="EMail address"/> <description for="ident_email_alias" value="EMail address"/>
<select id="ident_email_alias" span="all" class="et2_fullWidth"/> <select id="ident_email_alias" span="all" class="et2_fullWidth"/>
</row> </row>