From c1326dc20e9280b8075520867c5e0f9c3062917e Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 26 Sep 2016 15:22:49 -0400 Subject: [PATCH] (fix) search in all domain sources for Apple Calendar and properly handle groups --- Main/SOGo+DAV.m | 33 ++++++++----------- .../Appointments/SOGoAppointmentFolders.m | 13 +++++--- SoObjects/Appointments/SOGoCalendarProxy.h | 4 +-- SoObjects/Appointments/SOGoCalendarProxy.m | 4 +-- .../Appointments/SOGoUser+Appointments.h | 4 +-- .../Appointments/SOGoUser+Appointments.m | 4 +-- SoObjects/SOGo/SOGoGCSFolder.m | 6 ++-- SoObjects/SOGo/SOGoUserFolder.h | 2 +- SoObjects/SOGo/SOGoUserFolder.m | 8 ++--- 9 files changed, 34 insertions(+), 44 deletions(-) diff --git a/Main/SOGo+DAV.m b/Main/SOGo+DAV.m index a3adc000e..a2cb7800b 100644 --- a/Main/SOGo+DAV.m +++ b/Main/SOGo+DAV.m @@ -36,6 +36,7 @@ #import #import #import +#import #import "SOGo+DAV.h" @@ -359,31 +360,26 @@ withEmailAddressSetMatching: (NSString *) value inContext: (WOContext *) localContext { - id authenticationSource; - SOGoUser *activeUser; + SOGoUserManager *um; NSArray *records; NSUInteger count, max; NSString *uid; SOGoUserFolder *collection; - activeUser = [localContext activeUser]; - if ([activeUser respondsToSelector: @selector (authenticationSource)]) + um = [SOGoUserManager sharedUserManager]; + records = [um fetchUsersMatching: value + inDomain: [[localContext activeUser] domain]]; + + max = [records count]; + for (count = 0; count < max; count++) { - authenticationSource = [[localContext activeUser] authenticationSource]; - records = [authenticationSource - fetchContactsMatching: value - inDomain: [activeUser domain]]; - max = [records count]; - for (count = 0; count < max; count++) - { - uid = [[records objectAtIndex: count] objectForKey: @"c_uid"]; - if ([uid length] > 0) - { - collection = [[SOGoUser userWithLogin: uid] + uid = [[records objectAtIndex: count] objectForKey: @"c_uid"]; + if ([uid length] > 0) + { + collection = [[SOGoUser userWithLogin: uid] homeFolderInContext: localContext]; - [collections addObject: collection]; - } - } + [collections addObject: collection]; + } } } @@ -579,7 +575,6 @@ @"addressbook", @"calendar-access", @"calendar-schedule", @"calendar-auto-schedule", @"calendar-proxy", - @"calendar-query-extended", @"extended-mkcol", @"calendarserver-principal-property-search", diff --git a/SoObjects/Appointments/SOGoAppointmentFolders.m b/SoObjects/Appointments/SOGoAppointmentFolders.m index 856a3659e..913cc4632 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolders.m +++ b/SoObjects/Appointments/SOGoAppointmentFolders.m @@ -1,7 +1,7 @@ /* SOGoAppointmentFolders.m - this file is part of SOGo * - * Copyright (C) 2007-2015 Inverse inc. + * Copyright (C) 2007-2016 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 @@ -731,9 +731,14 @@ static SoSecurityManager *sm = nil; aclUser = [aclUsers objectAtIndex: userCount]; if (![subscribers containsObject: aclUser]) { - currentUser = [SOGoUser userWithLogin: aclUser]; - if ([currentUser hasSubscribedToCalendar: currentFolder]) - [subscribers addObject: aclUser]; + if ([aclUser hasPrefix: @"@"]) + [subscribers addObject: aclUser]; + else + { + currentUser = [SOGoUser userWithLogin: aclUser]; + if ([currentUser hasSubscribedToCalendar: currentFolder]) + [subscribers addObject: aclUser]; + } } } } diff --git a/SoObjects/Appointments/SOGoCalendarProxy.h b/SoObjects/Appointments/SOGoCalendarProxy.h index 60e693772..699c6284e 100644 --- a/SoObjects/Appointments/SOGoCalendarProxy.h +++ b/SoObjects/Appointments/SOGoCalendarProxy.h @@ -1,8 +1,6 @@ /* SOGoCalendarProxy.h - this file is part of SOGo * - * Copyright (C) 2009 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2009-2016 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/SoObjects/Appointments/SOGoCalendarProxy.m b/SoObjects/Appointments/SOGoCalendarProxy.m index dff9a4c46..0263e6eef 100644 --- a/SoObjects/Appointments/SOGoCalendarProxy.m +++ b/SoObjects/Appointments/SOGoCalendarProxy.m @@ -1,8 +1,6 @@ /* SOGoCalendarProxy.m - this file is part of SOGo * - * Copyright (C) 2009 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2009-2016 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/SoObjects/Appointments/SOGoUser+Appointments.h b/SoObjects/Appointments/SOGoUser+Appointments.h index b56879e5e..ca4127d90 100644 --- a/SoObjects/Appointments/SOGoUser+Appointments.h +++ b/SoObjects/Appointments/SOGoUser+Appointments.h @@ -1,8 +1,6 @@ /* SOGoUser+Appointments.h - this file is part of SOGo * - * Copyright (C) 2010 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2010-2016 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/SoObjects/Appointments/SOGoUser+Appointments.m b/SoObjects/Appointments/SOGoUser+Appointments.m index 3f7e67964..8b84901cd 100644 --- a/SoObjects/Appointments/SOGoUser+Appointments.m +++ b/SoObjects/Appointments/SOGoUser+Appointments.m @@ -1,8 +1,6 @@ /* SOGoUser+Appointments.m - this file is part of SOGo * - * Copyright (C) 2010 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2010-2016 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/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 3eeb7ffaf..77224c6ec 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -1865,9 +1865,9 @@ static NSArray *childRecordFields = nil; - (void) setRoles: (NSArray *) roles forUser: (NSString *) uid { - return [self setRoles: roles - forUser: uid - forObjectAtPath: [self pathArrayToFolder]]; + return [self setRoles: roles + forUser: uid + forObjectAtPath: [self pathArrayToFolder]]; } - (void) removeAclsForUsers: (NSArray *) users diff --git a/SoObjects/SOGo/SOGoUserFolder.h b/SoObjects/SOGo/SOGoUserFolder.h index 0621728a7..43a945242 100644 --- a/SoObjects/SOGo/SOGoUserFolder.h +++ b/SoObjects/SOGo/SOGoUserFolder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006-2014 Inverse inc. + Copyright (C) 2006-2016 Inverse inc. Copyright (C) 2004-2005 SKYRIX Software AG This file is part of SOGo. diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index c9241e586..162157e49 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -1,15 +1,13 @@ /* Copyright (C) 2004-2005 SKYRIX Software AG - Copyright (C) 2007-2011 Inverse inc. + Copyright (C) 2007-2016 Inverse inc. - This file is part of OpenGroupware.org. - - OGo is free software; you can redistribute it and/or modify it under + SOGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - OGo is distributed in the hope that it will be useful, but WITHOUT ANY + SOGo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.