diff --git a/ChangeLog b/ChangeLog index b2ba962a8..1b7b90a41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,25 @@ * SoObjects/SOGo/SOGoUserManager.m (_registerSource:): added sanity checks and warnings to the user. +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 + 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. + (-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 + creation rights on other calendars. + 2009-10-22 Ludovic Marcotte * SoObjects/SOGo/SOGoUserManager.m 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], diff --git a/UI/MailerUI/UIxMailMainFrame.m b/UI/MailerUI/UIxMailMainFrame.m index d09b1d8df..4f8064cb1 100644 --- a/UI/MailerUI/UIxMailMainFrame.m +++ b/UI/MailerUI/UIxMailMainFrame.m @@ -37,6 +37,7 @@ #import #import #import +#import #import #import @@ -175,7 +176,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,16 +225,23 @@ 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]]) + 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 card = [contact vCard]; - [addresses addObject: [self formattedMailtoString: card]]; + formattedMail = [self formattedMailtoString: card]; + if (formattedMail) + [addresses addObject: formattedMail]; } + uid = [uids nextObject]; } @@ -279,7 +287,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 +303,7 @@ } } } - if (fn) + if ([fn length] > 0) { [fn appendFormat: @" %@", email]; rc = fn; 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;