mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-20 22:05:57 +00:00
fix(calendar): rely on organizer's event state before updating attendee
When an attendee is adding a new event for which the organizer is local but doesn't have the event anymore, return a 412 error code. Fixes #5496
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2007-2020 Inverse inc.
|
||||
Copyright (C) 2007-2022 Inverse inc.
|
||||
|
||||
This file is part of SOGo
|
||||
|
||||
@@ -151,7 +151,8 @@
|
||||
if (possibleName)
|
||||
{
|
||||
object = [folder lookupName: possibleName
|
||||
inContext: context acquire: NO];
|
||||
inContext: context
|
||||
acquire: NO];
|
||||
if ([object isKindOfClass: [NSException class]] || [object isNew])
|
||||
object = nil;
|
||||
}
|
||||
@@ -163,10 +164,9 @@
|
||||
if (!object)
|
||||
{
|
||||
// Create the event in the user's personal calendar.
|
||||
folder = [[SOGoUser userWithLogin: uid]
|
||||
personalCalendarFolderInContext: context];
|
||||
folder = [[SOGoUser userWithLogin: uid] personalCalendarFolderInContext: context];
|
||||
object = [SOGoAppointmentObject objectWithName: nameInContainer
|
||||
inContainer: folder];
|
||||
inContainer: folder];
|
||||
[object setIsNew: YES];
|
||||
}
|
||||
|
||||
@@ -2528,6 +2528,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||
iCalEvent *currentMasterEvent;
|
||||
NSArray *folders;
|
||||
NSEnumerator *e;
|
||||
NSString *organizerUID;
|
||||
SOGoAppointmentFolder *folder;
|
||||
SOGoAppointmentObject *object;
|
||||
|
||||
@@ -2555,6 +2556,20 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Verify if the event is still present in the organizer calendar
|
||||
organizerUID = [[masterEvent organizer] uidInContext: context];
|
||||
if (organizerUID)
|
||||
{
|
||||
object = [self _lookupEvent: [masterEvent uid]
|
||||
forUID: organizerUID];
|
||||
if ([object isNew])
|
||||
{
|
||||
// The event has vanished
|
||||
return [NSException exceptionWithDAVStatus: 412
|
||||
reason: @"Precondition Failed"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -177,7 +177,7 @@ static SoSecurityManager *sm = nil;
|
||||
[folder setOCSPath: [NSString stringWithFormat: @"%@/%@", OCSPath, folderName]];
|
||||
|
||||
if ([folder create])
|
||||
[subFolders setObject: folder forKey: folderName];
|
||||
[subFolders setObject: folder forKey: folderName];
|
||||
}
|
||||
else if (folderType == SOGoCollectedFolder)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user