diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index 623bd1de6..32f06a965 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -419,23 +419,23 @@ forEvent: (iCalEvent *) theEvent { iCalPerson *currentAttendee; - NSMutableArray *attendees, *unavailableAttendees; + NSMutableArray *attendees, *unavailableAttendees, *whiteList; NSEnumerator *enumerator; - NSString *currentUID, *buffer; + NSPredicate *predicate; + NSString *currentUID, *ownerUID; NSMutableString *reason; NSDictionary *values; - NSMutableDictionary *value; - SOGoUser *user, *currentUser, *ownerUser; + NSMutableDictionary *value, *moduleSettings; + SOGoUser *user; SOGoUserSettings *us; - NSException *e; int count = 0, i = 0; - NSMutableArray *whiteList; - NSPredicate *predicate; + // Build list of the attendees uids without ressources attendees = [NSMutableArray arrayWithCapacity: [theAttendees count]]; unavailableAttendees = [[NSMutableArray alloc] init]; enumerator = [theAttendees objectEnumerator]; + ownerUID = [[[self context] activeUser] login]; while ((currentAttendee = [enumerator nextObject])) { @@ -444,16 +444,16 @@ { user = [SOGoUser userWithLogin: currentUID]; us = [user userSettings]; + moduleSettings = [us objectForKey:@"Calendar"]; if (![user isResource]) { // Check if the user prevented his account from beeing invited to events - if ([[us objectForKey:@"PreventInvitations"] boolValue]) + if ([[moduleSettings objectForKey:@"PreventInvitations"] boolValue]) { // Check if the user have a whiteList - whiteList = [NSMutableArray arrayWithObject:[us objectForKey:@"whiteListInvitations"]]; - predicate = [NSPredicate predicateWithFormat:@"SELF CONTAINS[cd] %@", @"sogo1"]; + whiteList = [NSMutableArray arrayWithObject:[moduleSettings objectForKey:@"PreventInvitationsWhitelist"]]; + predicate = [NSPredicate predicateWithFormat:@"SELF CONTAINS[cd] %@", ownerUID]; [whiteList filterUsingPredicate:predicate]; - // If the filter have a hit, do not add the currentUID to the unavailableAttendees array if ([whiteList count] == 0) { diff --git a/UI/PreferencesUI/UIxPreferences.h b/UI/PreferencesUI/UIxPreferences.h index 0164d247f..bbbb0a2b1 100644 --- a/UI/PreferencesUI/UIxPreferences.h +++ b/UI/PreferencesUI/UIxPreferences.h @@ -33,7 +33,6 @@ { id item; SOGoUser *user; - SOGoUserSettings *us; NGSieveClient *client; // Addressbook diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index 86416ed11..7e176c591 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -19,6 +19,7 @@ */ #import +#import #import #import #import @@ -642,38 +643,42 @@ static NSArray *reminderValues = nil; - (NSArray *) whiteListValue { SOGoUserSettings *us; - NSArray *whiteListValue; + NSMutableDictionary *moduleSettings; + NSArray *whiteList; us = [user userSettings]; - whiteListValue = [us objectForKey:@"whiteListInvitations"]; - - return whiteListValue; + moduleSettings = [us objectForKey: @"Calendar"]; + whiteList = [moduleSettings objectForKey:@"PreventInvitationsWhitelist"]; + return whiteList; } - (void) setWhiteListValue: (NSArray *) whiteList { SOGoUserSettings *us; - + NSMutableDictionary *moduleSettings; us = [user userSettings]; - [us setObject: whiteList forKey: @"whiteListInvitations"]; + moduleSettings = [us objectForKey: @"Calendar"]; + [moduleSettings setObject: whiteList forKey: @"PreventInvitationsWhitelist"]; [us synchronize]; } - (void) setPreventInvitations: (BOOL) preventInvitations { SOGoUserSettings *us; - + NSMutableDictionary *moduleSettings; us = [user userSettings]; - [us setBool: preventInvitations forKey: @"PreventInvitations"]; + moduleSettings = [us objectForKey: @"Calendar"]; + [moduleSettings setObject: [NSNumber numberWithBool: preventInvitations] forKey: @"PreventInvitations"]; [us synchronize]; } - (BOOL) preventInvitations { SOGoUserSettings *us; + NSMutableDictionary *moduleSettings; us = [user userSettings]; - - return [[us objectForKey: @"PreventInvitations"] boolValue]; + moduleSettings = [us objectForKey: @"Calendar"]; + return [[moduleSettings objectForKey: @"PreventInvitations"] boolValue]; } - (NSArray *) firstWeekList diff --git a/UI/WebServerResources/UIxPreferences.js b/UI/WebServerResources/UIxPreferences.js index 17685a533..04166ffb5 100644 --- a/UI/WebServerResources/UIxPreferences.js +++ b/UI/WebServerResources/UIxPreferences.js @@ -229,9 +229,9 @@ function initPreferences() { // Calendar whiteList var whiteList = $("appointmentsWhiteListWrapper"); if(whiteList) { - var whiteListValue = $("whiteListValue").getValue().split(","); - if (whiteListValue.length != 0) - { + var whiteListValue = $("whiteListValue").getValue(); + if (whiteListValue != "") { + whiteListValue = whiteListValue.split(","); var tablebody = $("appointmentsWhiteListWrapper").childNodesWithTag("table")[0].tBodies[0]; for (i = 0; i < whiteListValue.length; i++) {