bugfix PreventInvitation

This commit is contained in:
Alexandre Cloutier
2014-09-09 11:30:00 -04:00
parent 8c8e7d24a7
commit 9a380f711c
3 changed files with 63 additions and 59 deletions
+11 -14
View File
@@ -413,24 +413,22 @@
forEvent: (iCalEvent *) theEvent
{
iCalPerson *currentAttendee;
NSMutableArray *unavailableAttendees, *whiteList;
NSEnumerator *enumerator;
NSPredicate *predicate;
NSString *currentUID, *ownerUID;
NSMutableString *reason;
NSDictionary *values;
NSMutableDictionary *value, *moduleSettings;
SOGoUser *user;
SOGoUserSettings *us;
NSMutableArray *unavailableAttendees;
NSEnumerator *enumerator;
NSString *currentUID, *ownerUID, *whiteListString;
NSMutableString *reason;
NSDictionary *values;
NSMutableDictionary *value, *moduleSettings, *whiteList;
int i, count;
i = count = 0;
// Build list of the attendees uids without ressources
unavailableAttendees = [[NSMutableArray alloc] init];
enumerator = [theAttendees objectEnumerator];
ownerUID = [[[self context] activeUser] login];
while ((currentAttendee = [enumerator nextObject]))
{
currentUID = [currentAttendee uid];
@@ -443,11 +441,10 @@
if (![user isResource] && [[moduleSettings objectForKey:@"PreventInvitations"] boolValue])
{
// Check if the user have a whiteList
whiteList = [NSMutableArray arrayWithObject:[moduleSettings objectForKey:@"PreventInvitationsWhitelist"]];
predicate = [NSPredicate predicateWithFormat:@"SELF CONTAINS[cd] %@", ownerUID];
[whiteList filterUsingPredicate:predicate];
whiteListString = [moduleSettings objectForKey:@"PreventInvitationsWhitelist"];
whiteList = [whiteListString objectFromJSONString];
// If the filter have a hit, do not add the currentUID to the unavailableAttendees array
if ([whiteList count] == 0)
if (![whiteList objectForKey:ownerUID])
{
values = [NSDictionary dictionaryWithObject:[user cn] forKey:@"Cn"];
[unavailableAttendees addObject:values];