Removed tight coupling of group membership expansion and LDAPSource.

Any implementation of SOGoSource may now support group expansion by implementing the protocol MembershipAwareSource.
This commit is contained in:
Johannes Kanefendt committed 2019-11-26 15:29:02 +01:00
1 parent 856b0654ab
commit 2e98929900
15 files changed
+255 -569

No files matched your search

+12 -9
View File
@@ -59,6 +59,7 @@
#import <SOGo/SOGoWebDAVValue.h>
#import <SOGo/WORequest+SOGo.h>
#import <SOGo/WOResponse+SOGo.h>
#import <SOGo/SOGoSource.h>
#import "iCalCalendar+SOGo.h"
#import "iCalRepeatableEntityObject+SOGo.h"
@@ -70,7 +71,6 @@
#import "SOGoTaskObject.h"
#import "SOGoWebAppointmentFolder.h"
#define defaultColor @"#AAAAAA"
@interface SOGoGCSFolder (SOGoPrivate)
@@ -437,19 +437,22 @@ static Class iCalEventK = nil;
if (rc)
{
#warning Duplicated code from SOGoGCSFolder subscribeUserOrGroup
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: theIdentifier];
if ([[dict objectForKey: @"isGroup"] boolValue])
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
{
SOGoGroup *aGroup;
id <SOGoSource> source;
aGroup = [SOGoGroup groupWithIdentifier: theIdentifier
inDomain: [[context activeUser] domain]];
allUsers = [NSMutableArray arrayWithArray: [aGroup members]];
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
if ([source conformsToProtocol:@protocol(MembershipAwareSource)])
{
allUsers = [NSMutableArray arrayWithArray: [(id<MembershipAwareSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]]];
// We remove the active user from the group (if present) in order to
// not subscribe him to their own resource!
[allUsers removeObject: [context activeUser]];
// We remove the active user from the group (if present) in order to
// not subscribe him to their own resource!
[allUsers removeObject: [context activeUser]];
}
}
else
{