From e7788ac76ead7d679cbb1be73ab919ffe1f9b7d3 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 27 Jul 2009 21:36:03 +0000 Subject: [PATCH] See ChangeLog Monotone-Parent: c6303bf32ace41498a75993116922dcd96cd4ad5 Monotone-Revision: 6b0d38e3817a056f1bb60d2484e9c2bc8bd02234 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-07-27T21:36:03 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 7 ++++ .../Appointments/SOGoAppointmentFolder.m | 32 +++++++++++-------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2160ff38b..a10120bc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-07-27 Francis Lachapelle + + * SoObjects/Appointments/SOGoAppointmentFolder.m + ([SOGoAppointmentFolder + -roleForComponentsWithAccessClass:forUser:]): now returns an empty + string when user is owner of the calendar. + 2009-07-23 Cyril Robert * UI/Scheduler/UIxComponentEditor.m (repeatLabel), (ownerIsAttendee), diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index 9d13a8551..7347727e7 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -2449,7 +2449,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir - (NSString *) roleForComponentsWithAccessClass: (iCalAccessClass) accessClass forUser: (NSString *) uid { - NSString *accessRole, *prefix, *currentRole, *suffix; + NSString *accessRole, *ownerLogin, *prefix, *currentRole, *suffix; NSEnumerator *acls; NSMutableDictionary *userRoles; @@ -2468,22 +2468,28 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir userRoles = [NSMutableDictionary dictionaryWithCapacity: 3]; [aclMatrix setObject: userRoles forKey: uid]; } - + accessRole = [userRoles objectForKey: prefix]; if (!accessRole) { - acls = [[self aclsForUser: uid] objectEnumerator]; - currentRole = [acls nextObject]; - while (currentRole && !accessRole) - if ([currentRole hasPrefix: prefix]) - { - suffix = [currentRole substringFromIndex: [prefix length]]; - accessRole = [NSString stringWithFormat: @"Component%@", suffix]; - } - else - currentRole = [acls nextObject]; - if (!accessRole) + ownerLogin = [self ownerInContext: context]; + if ([ownerLogin isEqualToString: uid]) accessRole = @""; + else + { + acls = [[self aclsForUser: uid] objectEnumerator]; + currentRole = [acls nextObject]; + while (currentRole && !accessRole) + if ([currentRole hasPrefix: prefix]) + { + suffix = [currentRole substringFromIndex: [prefix length]]; + accessRole = [NSString stringWithFormat: @"Component%@", suffix]; + } + else + currentRole = [acls nextObject]; + if (!accessRole) + accessRole = @""; + } [userRoles setObject: accessRole forKey: prefix]; }