fix(core): improve debbuging when dealing with groups

This commit is contained in:
Ludovic Marcotte
2020-05-26 09:25:25 -04:00
parent e37ae5fec5
commit 5b6096e32c
3 changed files with 39 additions and 8 deletions
@@ -430,7 +430,6 @@ static Class iCalEventK = nil;
NSMutableArray *allUsers;
SOGoUserSettings *us;
NSDictionary *dict;
SOGoUser *sogoUser;
BOOL rc;
int i;
@@ -450,7 +449,9 @@ static Class iCalEventK = nil;
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
if ([source conformsToProtocol:@protocol(SOGoMembershipSource)])
{
NSArray *members = [(id<SOGoMembershipSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
NSArray *members;
members = [(id<SOGoMembershipSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
allUsers = [NSMutableArray array];
for (i = 0; i < [members count]; i++)
@@ -461,6 +462,11 @@ static Class iCalEventK = nil;
// not subscribe him to their own resource!
[allUsers removeObject: [[context activeUser] login]];
}
else
{
[self errorWithFormat: @"Inconsistency error - got group identifier (%@) from a source (%@) that does not support groups.", theIdentifier, [dict objectForKey: @"SOGoSource"]];
return NO;
}
}
else
{
@@ -587,6 +587,12 @@
[allAttendees addObject: person];
}
}
else
{
[self errorWithFormat: @"Inconsistency error - got group identifier (%@) from a source (%@) that does not support groups.", [currentAttendee rfc822Email], [dict objectForKey: @"SOGoSource"]];
RELEASE(pool);
return NO;
}
}
j++;
+25 -6
View File
@@ -941,7 +941,9 @@ static NSArray *childRecordFields = nil;
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
if ([source conformsToProtocol:@protocol(SOGoMembershipSource)])
{
NSArray *members = [(id<SOGoMembershipSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
NSArray *members;
members = [(id<SOGoMembershipSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
allUsers = [NSMutableArray array];
for (i = 0; i < [members count]; i++)
@@ -952,6 +954,11 @@ static NSArray *childRecordFields = nil;
// not subscribe him to their own resource!
[allUsers removeObject: [[context activeUser] login]];
}
else
{
[self errorWithFormat: @"Inconsistency error - got group identifier (%@) from a source (%@) that does not support groups.", theIdentifier, [dict objectForKey: @"SOGoSource"]];
return NO;
}
}
else
{
@@ -1626,7 +1633,7 @@ static NSArray *childRecordFields = nil;
matchingUID: (NSString *) uid
{
int count, max;
NSDictionary *record;
NSDictionary *record, *dict;
NSString *currentUID, *domain;
NSMutableArray *acls;
@@ -1640,14 +1647,21 @@ static NSArray *childRecordFields = nil;
if ([currentUID hasPrefix: @"@"])
{
domain = [[context activeUser] domain];
NSString *dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: currentUID
inDomain: domain];
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: currentUID
inDomain: domain];
if (dict)
{
id <SOGoSource> source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
if ([source conformsToProtocol:@protocol(SOGoMembershipSource)] &&
[(id<SOGoMembershipSource>)(source) groupWithUIDHasMemberWithUID: currentUID memberUid: uid])
[acls addObject: [record valueForKey: @"c_role"]];
{
[acls addObject: [record valueForKey: @"c_role"]];
}
else
{
[self errorWithFormat: @"Inconsistency error - got group identifier (%@) from a source (%@) that does not support groups.", currentUID, [dict objectForKey: @"SOGoSource"]];
return [NSArray array];
}
}
}
}
@@ -1779,8 +1793,8 @@ static NSArray *childRecordFields = nil;
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
if ([source conformsToProtocol:@protocol(SOGoMembershipSource)])
{
NSArray *members;
NSDictionary *user;
NSArray *members;
unsigned int j;
// Fetch members to remove them from the cache along the group
@@ -1796,6 +1810,11 @@ static NSArray *childRecordFields = nil;
[usersAndGroups replaceObjectAtIndex: i
withObject: [NSString stringWithFormat: @"@%@", uid]];
}
else
{
[self errorWithFormat: @"Inconsistency error - got group identifier (%@) from a source (%@) that does not support groups.", uid, [dict objectForKey: @"SOGoSource"]];
return;
}
}
}
objectPath = [objectPathArray componentsJoinedByString: @"/"];