* Calendar/CalDAV: new calendar-config to allow party-crashers with email matching a given regular expression

This commit is contained in:
ralf 2024-01-16 15:09:56 +02:00
parent 1ff62aafd4
commit 547d23b5f3
4 changed files with 32 additions and 3 deletions

View File

@ -1115,7 +1115,14 @@ class calendar_groupdav extends Api\CalDAV\Handler
(!$oldEvent['recur_type'] || !($series = self::get_series($oldEvent['uid'], $this->bo)))) (!$oldEvent['recur_type'] || !($series = self::get_series($oldEvent['uid'], $this->bo))))
{ {
if ($this->debug) error_log(__METHOD__."(,,$user) user $user is NOT an attendee!"); if ($this->debug) error_log(__METHOD__."(,,$user) user $user is NOT an attendee!");
return '403 Forbidden'; $ignore_acl = !empty($GLOBALS['egw_info']['server']['caldav_party_crasher_regexp']) &&
preg_match($GLOBALS['egw_info']['server']['caldav_party_crasher_regexp'], $email=Api\Accounts::id2name($user, 'account_email'));
if (!$ignore_acl)
{
$this->caldav->log("Returning '403 Forbidden' as #$user is NOT a participant of the event!");
return '403 Forbidden';
}
$this->caldav->log("Allowing user #$user because email '$email' matches '{$GLOBALS['egw_info']['server']['caldav_party_crasher_regexp']}'");
} }
// update only participant status and alarms of current user // update only participant status and alarms of current user
if (($events = $handler->icaltoegw($vCalendar))) if (($events = $handler->icaltoegw($vCalendar)))
@ -1124,7 +1131,7 @@ class calendar_groupdav extends Api\CalDAV\Handler
$master = null; $master = null;
foreach($events as $n => $event) foreach($events as $n => $event)
{ {
// for recurrances of event series, we need to read correct recurrence (or if series master is no first event) // for recurrences of event series, we need to read correct recurrence (or if series master is no first event)
if ($event['recurrence'] || $n && !$event['recurrence'] || isset($series)) if ($event['recurrence'] || $n && !$event['recurrence'] || isset($series))
{ {
// first try reading (virtual and real) exceptions // first try reading (virtual and real) exceptions
@ -1156,7 +1163,8 @@ class calendar_groupdav extends Api\CalDAV\Handler
{ {
if (!$this->bo->set_status($oldEvent['id'], $user, $event['participants'][$user], if (!$this->bo->set_status($oldEvent['id'], $user, $event['participants'][$user],
// real (not virtual) exceptions use recurrence 0 in egw_cal_user.cal_recurrence! // real (not virtual) exceptions use recurrence 0 in egw_cal_user.cal_recurrence!
$recurrence = $eventId == $oldEvent['id'] ? $event['recurrence'] : 0)) $recurrence = $eventId == $oldEvent['id'] ? $event['recurrence'] : 0,
$ignore_acl))
{ {
if ($this->debug) error_log(__METHOD__."(,,$user) failed to set_status($oldEvent[id], $user, '{$event['participants'][$user]}', $recurrence=".Api\DateTime::to($recurrence).')'); if ($this->debug) error_log(__METHOD__."(,,$user) failed to set_status($oldEvent[id], $user, '{$event['participants'][$user]}', $recurrence=".Api\DateTime::to($recurrence).')');
return '403 Forbidden'; return '403 Forbidden';
@ -1190,6 +1198,11 @@ class calendar_groupdav extends Api\CalDAV\Handler
return '204 No Content'; return '204 No Content';
} }
else
{
$this->caldav->log("Could NOT parse any event(s) from iCal --> returning 400 Bad Request!");
return '400 Bad Request';
}
if ($this->debug && !isset($events)) error_log(__METHOD__."(,,$user) only schedule-tag given for event without participants (only calendar owner) --> handle as regular PUT"); if ($this->debug && !isset($events)) error_log(__METHOD__."(,,$user) only schedule-tag given for event without participants (only calendar owner) --> handle as regular PUT");
} }
if ($return_no_access) if ($return_no_access)

View File

@ -17,6 +17,7 @@
, stati of participants reset calendar de , Status der Teilnehmer zurückgesetzt , stati of participants reset calendar de , Status der Teilnehmer zurückgesetzt
a list of email addresses of all participants who have not declined calendar de Eine Liste der E-Mail-Adressen aller Teilnehmer, die nicht abgelehnt haben. a list of email addresses of all participants who have not declined calendar de Eine Liste der E-Mail-Adressen aller Teilnehmer, die nicht abgelehnt haben.
a non blocking event will not conflict with other events calendar de Ein nicht blockierender Termin ergibt keinen Terminkonflikt mit anderen Terminen a non blocking event will not conflict with other events calendar de Ein nicht blockierender Termin ergibt keinen Terminkonflikt mit anderen Terminen
a party crasher in someone who is not invited to the meeting but somehow got the invitation. calendar de Ein Partycrasher ist jemand, der NICHT zu dem Treffen eingeladen ist, aber irgendwie die Einladung bekommen hat.
accept calendar de Zusagen accept calendar de Zusagen
accept or reject an invitation calendar de Einladung zusagen oder ablehnen accept or reject an invitation calendar de Einladung zusagen oder ablehnen
accepted calendar de Zugesagt accepted calendar de Zugesagt
@ -53,6 +54,7 @@ all future calendar de Alle zukünftigen
all incl. rejected calendar de Alle einschl. abgelehnte all incl. rejected calendar de Alle einschl. abgelehnte
all participants calendar de Alle Teilnehmer all participants calendar de Alle Teilnehmer
allow booking requests from any user when creating events? calendar de Erlaube Buchungsanfragen von beliebigen Benutzern bei der Erstellung von Terminen? allow booking requests from any user when creating events? calendar de Erlaube Buchungsanfragen von beliebigen Benutzern bei der Erstellung von Terminen?
allow party crashers with email that match the following regular expression calendar de Erlaube Partycrasher mit E-Mails, die dem folgenden regulären Ausdruck entsprechen
allow users to prevent change notifications ('do not notify') calendar de Erlaube Benutzern Benachrichtigungen über Änderungen zu unterdrücken ('Nicht benachrichtigen') allow users to prevent change notifications ('do not notify') calendar de Erlaube Benutzern Benachrichtigungen über Änderungen zu unterdrücken ('Nicht benachrichtigen')
allows to edit the event again calendar de Erlaubt den Termin erneut zu bearbeiten allows to edit the event again calendar de Erlaubt den Termin erneut zu bearbeiten
always calendar de Immer always calendar de Immer
@ -79,6 +81,7 @@ birthdays only calendar de Nur Geburtstage
both, holidays and birthdays calendar de Beide, Feier- und Geburtstage both, holidays and birthdays calendar de Beide, Feier- und Geburtstage
busy calendar de belegt busy calendar de belegt
by calendar de von by calendar de von
by default (nothing is set here) egroupware allows only the organizer/owner to add them. calendar de Standardmäßig (hier ist nichts eingestellt) erlaubt EGroupware nur dem Organisator/Besitzer, sie hinzuzufügen.
calendar - list calendar de Kalender - Listenansicht calendar - list calendar de Kalender - Listenansicht
calendar - multi-weekly calendar de Kalender - Mehrwochenansicht calendar - multi-weekly calendar de Kalender - Mehrwochenansicht
calendar - planner calendar de Kalender - Planeransicht calendar - planner calendar de Kalender - Planeransicht

View File

@ -17,6 +17,7 @@
, stati of participants reset calendar en , status of participants reset , stati of participants reset calendar en , status of participants reset
a list of email addresses of all participants who have not declined calendar en A list of email addresses of all participants who have not declined a list of email addresses of all participants who have not declined calendar en A list of email addresses of all participants who have not declined
a non blocking event will not conflict with other events calendar en A non blocking event will not conflict with other events a non blocking event will not conflict with other events calendar en A non blocking event will not conflict with other events
a party crasher in someone who is not invited to the meeting but somehow got the invitation. calendar en A party crasher in someone who is NOT invited to the meeting but somehow got the invitation.
accept calendar en Accept accept calendar en Accept
accept or reject an invitation calendar en Accept or reject an invitation accept or reject an invitation calendar en Accept or reject an invitation
accepted calendar en Accepted accepted calendar en Accepted
@ -53,6 +54,7 @@ all future calendar en All future
all incl. rejected calendar en All incl. rejected all incl. rejected calendar en All incl. rejected
all participants calendar en All participants all participants calendar en All participants
allow booking requests from any user when creating events? calendar en Allow booking requests from any user when creating events? allow booking requests from any user when creating events? calendar en Allow booking requests from any user when creating events?
allow party crashers with email that match the following regular expression calendar en Allow party crashers with email that match the following regular expression
allow users to prevent change notifications ('do not notify') calendar en Allow users to prevent change notifications 'Do not notify' allow users to prevent change notifications ('do not notify') calendar en Allow users to prevent change notifications 'Do not notify'
allows to edit the event again calendar en Allows to edit the event again allows to edit the event again calendar en Allows to edit the event again
always calendar en Always always calendar en Always
@ -79,6 +81,7 @@ birthdays only calendar en Birthdays only
both, holidays and birthdays calendar en Both, holidays and birthdays both, holidays and birthdays calendar en Both, holidays and birthdays
busy calendar en Busy busy calendar en Busy
by calendar en by by calendar en by
by default (nothing is set here) egroupware allows only the organizer/owner to add them. calendar en By default (nothing is set here) EGroupware allows only the organizer/owner to add them.
calendar - list calendar en Calendar - List calendar - list calendar en Calendar - List
calendar - multi-weekly calendar en Calendar - Multi week calendar - multi-weekly calendar en Calendar - Multi week
calendar - planner calendar en Calendar - Planner calendar - planner calendar en Calendar - Planner

View File

@ -48,6 +48,16 @@
<option value="true">No</option> <option value="true">No</option>
</et2-select> </et2-select>
</row> </row>
<row>
<et2-description value="Allow party crashers with email that match the following regular expression" label="%s:"></et2-description>
<et2-textbox id="newsettings[caldav_party_crasher_regexp]" placeholder="/^(someone@else.com|.*@(example.org|other.net))$/i"></et2-textbox>
</row>
<row>
<et2-vbox span="all">
<et2-description value="A party crasher in someone who is NOT invited to the meeting but somehow got the invitation."/>
<et2-description value="By default (nothing is set here) EGroupware allows only the organizer/owner to add them."/>
</et2-vbox>
</row>
<row> <row>
<et2-description value="Security" span="all" class="subHeader"></et2-description> <et2-description value="Security" span="all" class="subHeader"></et2-description>
</row> </row>