* Calendar/CalDAV: config to replace email-domain eg. for a migration

This commit is contained in:
Ralf Becker 2020-08-14 18:03:30 +02:00
parent 2cb0c613ba
commit aebc3bc2e9
3 changed files with 25 additions and 1 deletions

View File

@ -1033,6 +1033,13 @@ class Principals extends Handler
break;
case 'mailto':
// check if we need to replace email domain with something else in participants (mail address migration)
if (!empty($rest) && !empty($GLOBALS['egw_info']['server']['calendar_domain_replace']) &&
!empty($GLOBALS['egw_info']['server']['calendar_domain_replace_with']))
{
$rest = preg_replace('/@' . preg_quote($GLOBALS['egw_info']['server']['calendar_domain_replace'], '/') . '(>|$)/i',
'@' . $GLOBALS['egw_info']['server']['calendar_domain_replace_with'] . '$1', $e = $rest);
}
if (($uid = $GLOBALS['egw']->accounts->name2id($rest, 'account_email')))
{
$type = $uid > 0 ? 'users' : 'groups';

View File

@ -2797,6 +2797,13 @@ class calendar_ical extends calendar_boupdate
{
$email = $attributes['value'];
}
// check if we need to replace email domain with something else in participants (mail address migration)
if (!empty($email) && !empty($GLOBALS['egw_info']['server']['calendar_domain_replace']) &&
!empty($GLOBALS['egw_info']['server']['calendar_domain_replace_with']))
{
$email = preg_replace('/@'.preg_quote($GLOBALS['egw_info']['server']['calendar_domain_replace'], '/').'(>|$)/i',
'@'.$GLOBALS['egw_info']['server']['calendar_domain_replace_with'].'$1', $e=$email);
}
// try X-EGROUPWARE-UID, but only if it resolves to same email (otherwise we are in trouble if different EGw installs talk to each other)
if (!$uid && !empty($attributes['params']['X-EGROUPWARE-UID']) &&
($res_info = $this->resource_info($attributes['params']['X-EGROUPWARE-UID'])) &&

View File

@ -5,7 +5,7 @@
<template id="calendar.config" template="" lang="" group="0" version="16.1">
<grid width="100%" class="admin-config egwGridView_grid">
<columns>
<column width="60%"/>
<column width="50%"/>
<column/>
</columns>
<rows>
@ -120,6 +120,16 @@
<description value="Limit search for conflicts in recurrences to given number of recurrences"/>
<float id="newsettings[conflict_max_checked]"/>
</row>
<row>
<description value="Email address migration" span="all" class="subHeader"/>
</row>
<row>
<description value="Change domain of participants in CalDAV requests"/>
<hbox>
<textbox id="newsettings[calendar_domain_replace]" blur="replace" size="48"/>
<textbox id="newsettings[calendar_domain_replace_with]" blur="with" size="48"/>
</hbox>
</row>
</rows>
</grid>
</template>