From 9f55cdc725440f5932491f3c829610b6366c9ab2 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Wed, 3 Jun 2020 07:46:57 -0400 Subject: [PATCH] fix(core): added even better debugging for bogus groups --- SoObjects/SOGo/SOGoGCSFolder.m | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/SoObjects/SOGo/SOGoGCSFolder.m b/SoObjects/SOGo/SOGoGCSFolder.m index 6a996e6c7..5676babd1 100644 --- a/SoObjects/SOGo/SOGoGCSFolder.m +++ b/SoObjects/SOGo/SOGoGCSFolder.m @@ -956,7 +956,7 @@ static NSArray *childRecordFields = nil; } else { - [self errorWithFormat: @"Inconsistency error - got group identifier (%@) from a source (%@) that does not support groups.", theIdentifier, [dict objectForKey: @"SOGoSource"]]; + [self errorWithFormat: @"Inconsistency (subscribeUserOrGroup:reallyDo:response:) error - got group identifier (%@) from a source (%@) that does not support groups (%@).", theIdentifier, [dict objectForKey: @"SOGoSource"], NSStringFromClass([source class])]; return NO; } } @@ -1651,15 +1651,19 @@ static NSArray *childRecordFields = nil; inDomain: domain]; if (dict) { - id source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]]; - if ([source conformsToProtocol:@protocol(SOGoMembershipSource)] && - [(id)(source) groupWithUIDHasMemberWithUID: currentUID memberUid: uid]) + id source; + + source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]]; + if ([source conformsToProtocol:@protocol(SOGoMembershipSource)]) { - [acls addObject: [record valueForKey: @"c_role"]]; + if ([(id)(source) groupWithUIDHasMemberWithUID: currentUID memberUid: uid]) + [acls addObject: [record valueForKey: @"c_role"]]; + else + [self errorWithFormat: @"Group %@ has no member with UID %@", currentUID, uid]; } else { - [self errorWithFormat: @"Inconsistency error - got group identifier (%@) from a source (%@) that does not support groups.", currentUID, [dict objectForKey: @"SOGoSource"]]; + [self errorWithFormat: @"Inconsistency (_aclsFromGroupRoles:matchingUID:) error - got group identifier (%@) from a source (%@) that does not support groups (%@).", currentUID, [dict objectForKey: @"SOGoSource"], NSStringFromClass([source class])]; return [NSArray array]; } } @@ -1812,7 +1816,7 @@ static NSArray *childRecordFields = nil; } else { - [self errorWithFormat: @"Inconsistency error - got group identifier (%@) from a source (%@) that does not support groups (%@).", uid, [dict objectForKey: @"SOGoSource"], NSStringFromClass([source class])]; + [self errorWithFormat: @"Inconsistency error (removeAclsForUsers:forObjectAtPath:) - got group identifier (%@) from a source (%@) that does not support groups (%@).", uid, [dict objectForKey: @"SOGoSource"], NSStringFromClass([source class])]; return; } }