From c8e3e69ae24af064b64ed16e3f3e79dc185ce17b Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 23 Oct 2009 15:04:28 +0000 Subject: [PATCH 1/5] See ChangeLoG Monotone-Parent: 4f0bf8feeb9303c272c290edf3a27a53d5f0e7f6 Monotone-Revision: 362796632635e06d244977f425250ed41b4cd5c2 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-10-23T15:04:28 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 ++++ UI/Scheduler/UIxComponentEditor.m | 56 ++++++++++++++----------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d4e4c3c8..6b9e347a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-10-23 Francis Lachapelle + + * UI/Scheduler/UIxComponentEditor.m (-calendarList): added proper + verification of deletion rights on the current calendar and + creation rights on other calendars. + 2009-10-22 Ludovic Marcotte * SoObjects/SOGo/SOGoUserManager.m diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 6e4c61102..21e632f1c 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -997,25 +997,6 @@ iRANGE(2); return [NSNumber numberWithInt: participationStatus]; } -- (NSString *) _permissionForEditing -{ - NSString *perm; - - if ([[self clientObject] isNew]) - perm = SoPerm_AddDocumentsImagesAndFiles; - else - { - if ([privacy isEqualToString: @"PRIVATE"]) - perm = SOGoCalendarPerm_ModifyPrivateRecords; - else if ([privacy isEqualToString: @"CONFIDENTIAL"]) - perm = SOGoCalendarPerm_ModifyConfidentialRecords; - else - perm = SOGoCalendarPerm_ModifyPublicRecords; - } - - return perm; -} - - (NSArray *) calendarList { SOGoAppointmentFolder *calendar, *currentCalendar; @@ -1027,19 +1008,32 @@ iRANGE(2); if (!calendarList) { calendarList = [NSMutableArray new]; - - perm = [self _permissionForEditing]; - calendarParent - = [[context activeUser] calendarsFolderInContext: context]; - sm = [SoSecurityManager sharedSecurityManager]; calendar = [self componentCalendar]; - allCalendars = [[calendarParent subFolders] objectEnumerator]; - while ((currentCalendar = [allCalendars nextObject])) - if ([calendar isEqual: currentCalendar] || - ![sm validatePermission: perm - onObject: currentCalendar - inContext: context]) - [calendarList addObject: currentCalendar]; + sm = [SoSecurityManager sharedSecurityManager]; + + perm = SoPerm_DeleteObjects; + if ([sm validatePermission: perm + onObject: calendar + inContext: context]) + { + // User can't delete components from this calendar; + // don't add any calendar other than the current one + [calendarList addObject: calendar]; + } + else + { + // Find which calendars user has creation rights + perm = SoPerm_AddDocumentsImagesAndFiles; + calendarParent + = [[context activeUser] calendarsFolderInContext: context]; + allCalendars = [[calendarParent subFolders] objectEnumerator]; + while ((currentCalendar = [allCalendars nextObject])) + if ([calendar isEqual: currentCalendar] || + ![sm validatePermission: perm + onObject: currentCalendar + inContext: context]) + [calendarList addObject: currentCalendar]; + } } return calendarList; From fa43f053f7a00b1446720ff3471ae73d3833a874 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 23 Oct 2009 19:57:53 +0000 Subject: [PATCH 2/5] See ChangeLog Monotone-Parent: 362796632635e06d244977f425250ed41b4cd5c2 Monotone-Revision: 0269f0e288002384896f59f89f8205c3327b32fb Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-10-23T19:57:53 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ UI/MailerUI/UIxMailMainFrame.m | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b9e347a0..bb7a8289c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2009-10-23 Francis Lachapelle + * UI/MailerUI/UIxMailMainFrame.m (-formattedMailtoString:): fixed + the case when dealing with a NGVCardReference (from a list) with + no FN attribute and no N attribute. + * UI/Scheduler/UIxComponentEditor.m (-calendarList): added proper verification of deletion rights on the current calendar and creation rights on other calendars. diff --git a/UI/MailerUI/UIxMailMainFrame.m b/UI/MailerUI/UIxMailMainFrame.m index d09b1d8df..6e79f6c41 100644 --- a/UI/MailerUI/UIxMailMainFrame.m +++ b/UI/MailerUI/UIxMailMainFrame.m @@ -279,7 +279,8 @@ // We append the contact's name fn = [NSMutableString stringWithString: [card fn]]; - if ([fn length] == 0) + if ([fn length] == 0 + && [card isKindOfClass: [NGVCard class]]) { n = [card n]; if (n) @@ -294,7 +295,7 @@ } } } - if (fn) + if ([fn length] > 0) { [fn appendFormat: @" %@", email]; rc = fn; From 602d6748e853055e364b1f634a1a26bffa33033b Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 23 Oct 2009 20:11:56 +0000 Subject: [PATCH 3/5] See ChangeLog Monotone-Parent: 0269f0e288002384896f59f89f8205c3327b32fb Monotone-Revision: 46d81097556b9377a3e1d2a4ed9a7083a5de8a77 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-10-23T20:11:56 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 2 ++ UI/MailerUI/UIxMailMainFrame.m | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index bb7a8289c..3c0ae8d13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * UI/MailerUI/UIxMailMainFrame.m (-formattedMailtoString:): fixed the case when dealing with a NGVCardReference (from a list) with no FN attribute and no N attribute. + (-composeAction): fixed the case when dealing with a contact with + no email address. * UI/Scheduler/UIxComponentEditor.m (-calendarList): added proper verification of deletion rights on the current calendar and diff --git a/UI/MailerUI/UIxMailMainFrame.m b/UI/MailerUI/UIxMailMainFrame.m index 6e79f6c41..b367f9a02 100644 --- a/UI/MailerUI/UIxMailMainFrame.m +++ b/UI/MailerUI/UIxMailMainFrame.m @@ -175,7 +175,7 @@ { id contact; NSArray *accounts, *contactsId, *cards; - NSString *firstAccount, *firstEscapedAccount, *newLocation, *parameters, *folderId, *uid; + NSString *firstAccount, *firstEscapedAccount, *newLocation, *parameters, *folderId, *uid, *formattedMail; NSEnumerator *uids; NSMutableArray *addresses; NGVCard *card; @@ -224,15 +224,20 @@ cards = [list cardReferences]; count = [cards count]; for (i = 0; i < count; i++) - [addresses addObject: - [self formattedMailtoString: [cards objectAtIndex: i]]]; + { + formattedMail = [self formattedMailtoString: [cards objectAtIndex: i]]; + if (formattedMail) + [addresses addObject: formattedMail]; + } } else if ([contact isKindOfClass: [SOGoContactGCSEntry class]]) { // We fetch the preferred email address of the contact or // the first defined email address card = [contact vCard]; - [addresses addObject: [self formattedMailtoString: card]]; + formattedMail = [self formattedMailtoString: card]; + if (formattedMail) + [addresses addObject: formattedMail]; } uid = [uids nextObject]; } From b4939043572ac699286647b4dad302b52a2eb1d6 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 23 Oct 2009 20:25:36 +0000 Subject: [PATCH 4/5] See ChangeLog Monotone-Parent: 46d81097556b9377a3e1d2a4ed9a7083a5de8a77 Monotone-Revision: 5cc529e77d87c48d01d645b60e6978e296c9f09a Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-10-23T20:25:36 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 2 ++ UI/MailerUI/UIxMailMainFrame.m | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3c0ae8d13..01a314f7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ no FN attribute and no N attribute. (-composeAction): fixed the case when dealing with a contact with no email address. + (-composeAction): fixed the case when dealing with a contact from + an LDAP source. * UI/Scheduler/UIxComponentEditor.m (-calendarList): added proper verification of deletion rights on the current calendar and diff --git a/UI/MailerUI/UIxMailMainFrame.m b/UI/MailerUI/UIxMailMainFrame.m index b367f9a02..4f8064cb1 100644 --- a/UI/MailerUI/UIxMailMainFrame.m +++ b/UI/MailerUI/UIxMailMainFrame.m @@ -37,6 +37,7 @@ #import #import #import +#import #import #import @@ -230,7 +231,8 @@ [addresses addObject: formattedMail]; } } - else if ([contact isKindOfClass: [SOGoContactGCSEntry class]]) + else if ([contact isKindOfClass: [SOGoContactGCSEntry class]] + || [contact isKindOfClass: [SOGoContactLDIFEntry class]]) { // We fetch the preferred email address of the contact or // the first defined email address @@ -239,6 +241,7 @@ if (formattedMail) [addresses addObject: formattedMail]; } + uid = [uids nextObject]; } From 7663cdc37d5d37441105d8eb1a6d0e45ee45a566 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 23 Oct 2009 21:00:49 +0000 Subject: [PATCH 5/5] See ChangeLog Monotone-Parent: 5cc529e77d87c48d01d645b60e6978e296c9f09a Monotone-Revision: 7c369f5daacf319b74a648fea43f833dda69d81d Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-10-23T21:00:49 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ SoObjects/SOGo/SOGoUserFolder.m | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 01a314f7a..a3f9fa915 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-10-23 Ludovic Marcotte + + * SoObjects/SOGo/SOGoUserFolder.m (-subFoldersFromFolder:) + Addded a check to NOT return web calendars in this query. + 2009-10-23 Francis Lachapelle * UI/MailerUI/UIxMailMainFrame.m (-formattedMailtoString:): fixed diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index 1bcdb660d..e55f8bce9 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -170,7 +170,8 @@ static NSString *LDAPContactInfoAttribute = nil; if (![securityManager validatePermission: SOGoPerm_AccessObject onObject: currentFolder inContext: context] && [[currentFolder ownerInContext: context] - isEqualToString: folderOwner]) + isEqualToString: folderOwner] + && [NSStringFromClass([currentFolder class]) compare: @"SOGoWebAppointmentFolder"] != NSOrderedSame) { folderName = [NSString stringWithFormat: @"/%@/%@", [parentFolder nameInContainer],