(fix) Improve prevent invitations error handling

pull/66/merge
Ludovic Marcotte 2015-04-17 09:41:39 -04:00
parent beb666bc5f
commit 3872af35d1
2 changed files with 17 additions and 6 deletions

View File

@ -421,11 +421,14 @@
SOGoUserSettings *us;
NSMutableArray *unavailableAttendees;
NSEnumerator *enumerator;
NSString *currentUID, *ownerUID, *whiteListString;
NSString *currentUID, *ownerUID;
NSMutableString *reason;
NSDictionary *values;
NSMutableDictionary *value, *moduleSettings, *whiteList;
NSMutableDictionary *value, *moduleSettings;
id whiteList;
int i, count;
i = count = 0;
// Build list of the attendees uids without ressources
@ -447,8 +450,11 @@
if (![user isResource] && [[moduleSettings objectForKey:@"PreventInvitations"] boolValue])
{
// Check if the user have a whiteList
whiteListString = [moduleSettings objectForKey:@"PreventInvitationsWhitelist"];
whiteList = [whiteListString objectFromJSONString];
whiteList = [moduleSettings objectForKey:@"PreventInvitationsWhitelist"];
// For backward <= 2.2.17 compatibility
if ([whiteList isKindOfClass: [NSString class]])
whiteList = [whiteList objectFromJSONString];
// If the filter have a hit, do not add the currentUID to the unavailableAttendees array
if (![whiteList objectForKey:ownerUID])

View File

@ -660,12 +660,17 @@ static NSArray *reminderValues = nil;
- (void) setWhiteList: (NSString *) whiteListString
{
SOGoUserSettings *us;
NSMutableDictionary *moduleSettings;
SOGoUserSettings *us;
id o;
us = [user userSettings];
moduleSettings = [us objectForKey: @"Calendar"];
[moduleSettings setObject: [whiteListString objectFromJSONString] forKey: @"PreventInvitationsWhitelist"];
if (!(o = [whiteListString objectFromJSONString]))
o = [NSDictionary dictionary];
[moduleSettings setObject: o forKey: @"PreventInvitationsWhitelist"];
[us synchronize];
}