diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2022-09-08 12:42:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-08 12:42:03 +0200 |
commit | c77cc80fcc2845416ec1a8cc2a26fcb63881bfe7 (patch) | |
tree | 46b615abb0293f52c2331f6afd31809dfb6a20c3 /lib | |
parent | 5555500e9875011e511de6702f93e2462a7ce368 (diff) | |
parent | e3a52ce13e501005736736def2fa8889fe47add1 (diff) | |
download | nextcloud-server-c77cc80fcc2845416ec1a8cc2a26fcb63881bfe7.tar.gz nextcloud-server-c77cc80fcc2845416ec1a8cc2a26fcb63881bfe7.zip |
Merge pull request #33906 from nextcloud/fix/fix-calendar-tests-getTimestamp
Fix Calendar tests mocking a non-existant method.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Calendar/Manager.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php index f0b8e9fd50d..550ba36dd6b 100644 --- a/lib/private/Calendar/Manager.php +++ b/lib/private/Calendar/Manager.php @@ -330,12 +330,27 @@ class Manager implements IManager { // to the email address in the ORGANIZER. // We don't want to accept a CANCEL request from just anyone $organizer = substr($vEvent->{'ORGANIZER'}->getValue(), 7); - if (strcasecmp($sender, $organizer) !== 0 && strcasecmp($replyTo, $organizer) !== 0) { + $isNotOrganizer = ($replyTo !== null) ? (strcasecmp($sender, $organizer) !== 0 && strcasecmp($replyTo, $organizer) !== 0) : (strcasecmp($sender, $organizer) !== 0); + if ($isNotOrganizer) { $this->logger->warning('Sender must be the ORGANIZER of this event'); return false; } + //check if the event is in the future + /** @var DateTime $eventTime */ + $eventTime = $vEvent->{'DTSTART'}; + if ($eventTime->getDateTime()->getTimeStamp() < $this->timeFactory->getTime()) { // this might cause issues with recurrences + $this->logger->warning('Only events in the future are processed'); + return false; + } + + // Check if we have a calendar to work with $calendars = $this->getCalendarsForPrincipal($principalUri); + if (empty($calendars)) { + $this->logger->warning('Could not find any calendars for principal ' . $principalUri); + return false; + } + $found = null; // if the attendee has been found in at least one calendar event with the UID of the iMIP event // we process it. |