aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/CalDAV/Schedule/IMipPlugin.php53
-rw-r--r--apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php5
2 files changed, 54 insertions, 4 deletions
diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
index 3ff3ed0c569..56b3ab04ddc 100644
--- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
+++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
@@ -239,9 +239,42 @@ class IMipPlugin extends SabreIMipPlugin {
$meetingAttendeeName, $meetingInviteeName);
$this->addBulletList($template, $l10n, $meetingWhen, $meetingLocation,
$meetingDescription, $meetingUrl);
- $this->addResponseButtons($template, $l10n, $iTipMessage, $lastOccurrence);
+
+
+ // Only add response buttons to invitation requests: Fix Issue #11230
+ if (($method == self::METHOD_REQUEST) && $this->getAttendeeRSVP($attendee)) {
+
+ /*
+ ** Only offer invitation accept/reject buttons, which link back to the
+ ** nextcloud server, to recipients who can access the nextcloud server via
+ ** their internet/intranet. Issue #12156
+ **
+ ** The app setting is stored in the appconfig database table.
+ **
+ ** For nextcloud servers accessible to the public internet, the default
+ ** "invitation_link_recipients" value "yes" (all recipients) is appropriate.
+ **
+ ** When the nextcloud server is restricted behind a firewall, accessible
+ ** only via an internal network or via vpn, you can set "dav.invitation_link_recipients"
+ ** to the email address or email domain, or comma separated list of addresses or domains,
+ ** of recipients who can access the server.
+ **
+ ** To always deliver URLs, set invitation_link_recipients to "yes".
+ ** To suppress URLs entirely, set invitation_link_recipients to boolean "no".
+ */
+
+ $recipientDomain = substr(strrchr($recipient, "@"), 1);
+ $invitationLinkRecipients = explode(',', preg_replace('/\s+/', '', strtolower($this->config->getAppValue('dav', 'invitation_link_recipients', 'yes'))));
+
+ if (strcmp('yes', $invitationLinkRecipients[0]) === 0
+ || in_array(strtolower($recipient), $invitationLinkRecipients)
+ || in_array(strtolower($recipientDomain), $invitationLinkRecipients)) {
+ $this->addResponseButtons($template, $l10n, $iTipMessage, $lastOccurrence);
+ }
+ }
$template->addFooter();
+
$message->useTemplate($template);
$attachment = $this->mailer->createAttachment(
@@ -346,6 +379,21 @@ class IMipPlugin extends SabreIMipPlugin {
}
/**
+ * @param Property|null $attendee
+ * @return bool
+ */
+ private function getAttendeeRSVP(Property $attendee = null) {
+ if ($attendee !== null) {
+ $rsvp = $attendee->offsetGet('RSVP');
+ if (($rsvp instanceof Parameter) && (strcasecmp($rsvp->getValue(), 'TRUE') === 0)) {
+ return true;
+ }
+ }
+ // RFC 5545 3.2.17: default RSVP is false
+ return false;
+ }
+
+ /**
* @param IL10N $l10n
* @param Property $dtstart
* @param Property $dtend
@@ -447,7 +495,6 @@ class IMipPlugin extends SabreIMipPlugin {
$template->setSubject('Invitation: ' . $summary);
$template->addHeading($l10n->t('%1$s invited you to »%2$s«', [$inviteeName, $summary]), $l10n->t('Hello %s,', [$attendeeName]));
}
-
}
/**
@@ -504,7 +551,7 @@ class IMipPlugin extends SabreIMipPlugin {
$moreOptionsURL, $l10n->t('More options …')
]);
$text = $l10n->t('More options at %s', [$moreOptionsURL]);
-
+
$template->addBodyText($html, $text);
}
diff --git a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php
index 67c1a9a5118..63a5da96b73 100644
--- a/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php
@@ -57,7 +57,10 @@ class AnonymousOptionsPlugin extends ServerPlugin {
* @return bool
*/
public function handleAnonymousOptions(RequestInterface $request, ResponseInterface $response) {
- if ($request->getHeader('Authorization') === null && $request->getMethod() === 'OPTIONS' && $this->isRequestInRoot($request->getPath())) {
+ $isOffice = preg_match('/Microsoft Office/i', $request->getHeader('User-Agent'));
+ $isAnonymousOption = ($request->getMethod() === 'OPTIONS' && ($request->getHeader('Authorization') === null || trim($request->getHeader('Authorization')) === 'Bearer') && $this->isRequestInRoot($request->getPath()));
+ $isOfficeHead = $request->getMethod() === 'HEAD' && $isOffice && $request->getHeader('Authorization') === 'Bearer';
+ if ($isAnonymousOption || $isOfficeHead) {
/** @var CorePlugin $corePlugin */
$corePlugin = $this->server->getPlugin('core');
// setup a fake tree for anonymous access