Warn user when overbooking a resource

Fixes #2541
pull/17/head
Francis Lachapelle 2014-02-03 11:03:23 -05:00
parent 9e9407cf30
commit 2f0419c18a
2 changed files with 27 additions and 8 deletions

1
NEWS
View File

@ -21,6 +21,7 @@ Enhancements
- respect Sieve server capabilities
- encode messages in quoted-printable when content is bigger than 72 bytes
- we now use binary encoding in memcached (#2587)
- warn user when overbooking a resource by creating an event in its calendar (#2541)
Bug fixes
- don't load 'background' attribute (#2437)

View File

@ -431,18 +431,38 @@
forEvent: (iCalEvent *) theEvent
{
iCalPerson *currentAttendee;
NSMutableArray *attendees;
NSEnumerator *enumerator;
NSString *currentUID;
SOGoUser *user;
SOGoUser *user, *currentUser, *ownerUser;
// Build a list of the attendees uids
attendees = [NSMutableArray arrayWithCapacity: [theAttendees count]];
enumerator = [theAttendees objectEnumerator];
while ((currentAttendee = [enumerator nextObject]))
{
currentUID = [currentAttendee uid];
if (currentUID)
{
{
[attendees addObject: currentUID];
}
}
// If the active user is not the owner of the calendar, check possible conflict when
// the owner is a resource
currentUser = [context activeUser];
if (!activeUserIsOwner && ![currentUser isSuperUser])
{
ownerUser = [SOGoUser userWithLogin: owner];
if ([ownerUser isResource])
{
[attendees addObject: owner];
}
}
enumerator = [attendees objectEnumerator];
while ((currentUID = [enumerator nextObject]))
{
user = [SOGoUser userWithLogin: currentUID];
if ([user isResource])
@ -461,8 +481,7 @@
start = [[theEvent startDate] dateByAddingYears: 0 months: 0 days: 0 hours: 0 minutes: 0 seconds: 1];
end = [[theEvent endDate] dateByAddingYears: ([theEvent isRecurrent] ? 1 : 0) months: 0 days: 0 hours: 0 minutes: 0 seconds: -1];
folder = [[SOGoUser userWithLogin: currentUID]
personalCalendarFolderInContext: context];
folder = [user personalCalendarFolderInContext: context];
// Deny access to the resource if the ACLs don't allow the user
if (![folder aclSQLListingFilter])
@ -571,7 +590,6 @@
[currentAttendee setParticipationStatus: iCalPersonPartStatAccepted];
}
}
}
}
return nil;
@ -787,7 +805,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
[self expandGroupsInEvent: newEvent];
// We first update the event. It is important to this initially
// We first update the event. It is important to do this initially
// as the event's UID might get modified.
[super updateComponent: newEvent];