From ee7fdcba9ffdafc57dbf8e1c74a7a77d043d59fe Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Tue, 29 Aug 2017 15:09:08 -0400 Subject: [PATCH] Improve cache cleanup when removing a group ACL --- SoObjects/SOGo/SOGoGCSFolder.m | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 051bf7d51..bd60c49b2 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -1753,27 +1753,25 @@ static NSArray *childRecordFields = nil; for (i = 0; i < [usersAndGroups count]; i++) { uid = [usersAndGroups objectAtIndex: i]; - if (![uid hasPrefix: @"@"]) + group = [SOGoGroup groupWithIdentifier: uid inDomain: domain]; + if (group) { - group = [SOGoGroup groupWithIdentifier: uid inDomain: domain]; - if (group) + NSArray *members; + SOGoUser *user; + unsigned int j; + + // Fetch members to remove them from the cache along the group + members = [group members]; + for (j = 0; j < [members count]; j++) { - NSArray *members; - SOGoUser *user; - unsigned int j; - - // Fetch members to remove them from the cache along the group - members = [group members]; - for (j = 0; j < [members count]; j++) - { - user = [members objectAtIndex: j]; - [groupsMembers addObject: [user login]]; - } - - // Prefix the UID with the character "@" when dealing with a group - [usersAndGroups replaceObjectAtIndex: i - withObject: [NSString stringWithFormat: @"@%@", uid]]; + user = [members objectAtIndex: j]; + [groupsMembers addObject: [user login]]; } + + if (![uid hasPrefix: @"@"]) + // Prefix the UID with the character "@" when dealing with a group + [usersAndGroups replaceObjectAtIndex: i + withObject: [NSString stringWithFormat: @"@%@", uid]]; } } objectPath = [objectPathArray componentsJoinedByString: @"/"];