From 990f782b627ed956755b727ef3b043d5d66cb14c Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 11 Dec 2014 10:01:21 -0500 Subject: [PATCH] Allow including or not freebusy info from subscribed calendars --- NEWS | 6 ++++++ SoObjects/Appointments/SOGoAppointmentFolder.m | 17 +++++++++++++++-- SoObjects/Appointments/SOGoFreeBusyObject.h | 3 +-- SoObjects/Appointments/SOGoFreeBusyObject.m | 5 ++--- UI/Scheduler/UIxCalendarProperties.h | 5 +---- UI/Scheduler/UIxCalendarProperties.m | 14 +------------- .../SchedulerUI/UIxCalendarProperties.wox | 6 ++---- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/NEWS b/NEWS index 2b9d9616b..06c0efc12 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +2.2.12 (2014-12-xx) +------------------- + +New features + - Allow including or not freebusy info from subscribed calendars + 2.2.11a (2014-12-10) -------------------- diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 0b5399107..75d02ea5b 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -487,15 +487,28 @@ static Class iCalEventK = nil; inCategory: @"FolderSynchronize"]; } +// +// If the user is the owner of the calendar, by default we include the freebusy information. +// +// If the user is NOT the owner of the calendar, by default we exclude the freebusy information. +// - (BOOL) includeInFreeBusy { NSNumber *excludeFromFreeBusy; - + NSString *userLogin; + BOOL is_owner; + + userLogin = [[context activeUser] login]; + is_owner = [userLogin isEqualToString: [self ownerInContext: context]]; + // Check if the owner (not the active user) has excluded the calendar from her/his free busy data. excludeFromFreeBusy = [self folderPropertyValueInCategory: @"FreeBusyExclusions" - forUser: [SOGoUser userWithLogin: [self ownerInContext: context]]]; + forUser: [SOGoUser userWithLogin: userLogin]]; + if (!excludeFromFreeBusy && !is_owner) + return NO; + return ![excludeFromFreeBusy boolValue]; } diff --git a/SoObjects/Appointments/SOGoFreeBusyObject.h b/SoObjects/Appointments/SOGoFreeBusyObject.h index 77b2f53ec..17f56dd51 100644 --- a/SoObjects/Appointments/SOGoFreeBusyObject.h +++ b/SoObjects/Appointments/SOGoFreeBusyObject.h @@ -1,6 +1,5 @@ /* - Copyright (C) 2007-2012 Inverse inc. - Copyright (C) 2000-2004 SKYRIX Software AG + Copyright (C) 2007-2014 Inverse inc. This file is part of SOGo diff --git a/SoObjects/Appointments/SOGoFreeBusyObject.m b/SoObjects/Appointments/SOGoFreeBusyObject.m index 18f08e10b..6624a2cfe 100644 --- a/SoObjects/Appointments/SOGoFreeBusyObject.m +++ b/SoObjects/Appointments/SOGoFreeBusyObject.m @@ -1,6 +1,5 @@ /* - Copyright (C) 2007-2012 Inverse inc. - Copyright (C) 2000-2004 SKYRIX Software AG + Copyright (C) 2007-2014 Inverse inc. This file is part of SOGo @@ -339,7 +338,7 @@ for (count = 0; count < max; count++) { calFolder = [folders objectAtIndex: count]; - if (![calFolder isSubscription] && [calFolder includeInFreeBusy]) + if ([calFolder includeInFreeBusy]) [infos addObjectsFromArray: [calFolder fetchFreeBusyInfosFrom: startDate to: endDate]]; } diff --git a/UI/Scheduler/UIxCalendarProperties.h b/UI/Scheduler/UIxCalendarProperties.h index 157653dc2..de17b6117 100644 --- a/UI/Scheduler/UIxCalendarProperties.h +++ b/UI/Scheduler/UIxCalendarProperties.h @@ -1,9 +1,6 @@ /* UIxCalendarProperties.m - this file is part of SOGo * - * Copyright (C) 2008-2012 Inverse inc. - * - * Author: Wolfgang Sourdeau - * Ludovic Marcotte + * Copyright (C) 2008-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/UI/Scheduler/UIxCalendarProperties.m b/UI/Scheduler/UIxCalendarProperties.m index 3817ad48d..8f0ec4e81 100644 --- a/UI/Scheduler/UIxCalendarProperties.m +++ b/UI/Scheduler/UIxCalendarProperties.m @@ -1,9 +1,6 @@ /* UIxCalendarProperties.m - this file is part of SOGo * - * Copyright (C) 2008-2012 Inverse inc. - * - * Author: Wolfgang Sourdeau - * Ludovic Marcotte + * Copyright (C) 2008-2014 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -181,15 +178,6 @@ [calendar setShowCalendarTasks: new]; } -- (BOOL) userIsOwner -{ - NSString *userLogin; - - userLogin = [[context activeUser] login]; - - return ([userLogin isEqualToString: [calendar ownerInContext: context]]); -} - - (BOOL) isPublicAccessEnabled { // NOTE: This method is the same found in Common/UIxAclEditor.m diff --git a/UI/Templates/SchedulerUI/UIxCalendarProperties.wox b/UI/Templates/SchedulerUI/UIxCalendarProperties.wox index 8451318e6..20772c200 100644 --- a/UI/Templates/SchedulerUI/UIxCalendarProperties.wox +++ b/UI/Templates/SchedulerUI/UIxCalendarProperties.wox @@ -113,16 +113,14 @@ >
-
+ >