From 817e7a9de1e6d480be7dad19a0ce5ce692b6d388 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Fri, 8 Oct 2021 16:34:43 +0200 Subject: [PATCH] Update attendence for external users For local users it's possible to select their calendar via the principal url and first update their own attendance status. External users have no calendar event hence the recipient is the organizer. Signed-off-by: Daniel Kesselberg --- .../CalDAV/InvitationResponse/InvitationResponseServer.php | 6 ++++++ apps/dav/lib/Controller/InvitationResponseController.php | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php b/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php index d1ea6902af39a..7910eb614b71f 100644 --- a/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php +++ b/apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php @@ -121,4 +121,10 @@ public function handleITipMessage(Message $iTipMessage) { $schedulingPlugin = $this->server->getPlugin('caldav-schedule'); $schedulingPlugin->scheduleLocalDelivery($iTipMessage); } + + public function isExternalAttendee(string $principalUri): bool { + /** @var \Sabre\DAVACL\Plugin $aclPlugin */ + $aclPlugin = $this->server->getPlugin('acl'); + return $aclPlugin->getPrincipalByUri($principalUri) === null; + } } diff --git a/apps/dav/lib/Controller/InvitationResponseController.php b/apps/dav/lib/Controller/InvitationResponseController.php index 9dbe43199d896..de22e3ba6a9e6 100644 --- a/apps/dav/lib/Controller/InvitationResponseController.php +++ b/apps/dav/lib/Controller/InvitationResponseController.php @@ -198,7 +198,12 @@ private function buildITipResponse(array $row, string $partStat, int $guests = n $iTipMessage->method = 'REPLY'; $iTipMessage->sequence = $row['sequence']; $iTipMessage->sender = $row['attendee']; - $iTipMessage->recipient = $row['attendee']; + + if ($this->responseServer->isExternalAttendee($row['attendee'])) { + $iTipMessage->recipient = $row['organizer']; + } else { + $iTipMessage->recipient = $row['attendee']; + } $message = <<