- Respect the user domain when dealing with groups
- Renamed protocol MembershipAwareSource to SOGoMembershipSourcepull/263/head
parent
278d4ab4cb
commit
948c89f5bb
|
@ -425,7 +425,7 @@ static Class iCalEventK = nil;
|
||||||
response: (WOResponse *) theResponse
|
response: (WOResponse *) theResponse
|
||||||
{
|
{
|
||||||
NSMutableDictionary *moduleSettings, *folderShowAlarms, *freeBusyExclusions;
|
NSMutableDictionary *moduleSettings, *folderShowAlarms, *freeBusyExclusions;
|
||||||
NSString *subscriptionPointer;
|
NSString *subscriptionPointer, *domain;
|
||||||
NSMutableArray *allUsers;
|
NSMutableArray *allUsers;
|
||||||
SOGoUserSettings *us;
|
SOGoUserSettings *us;
|
||||||
NSDictionary *dict;
|
NSDictionary *dict;
|
||||||
|
@ -438,16 +438,18 @@ static Class iCalEventK = nil;
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
#warning Duplicated code from SOGoGCSFolder subscribeUserOrGroup
|
#warning Duplicated code from SOGoGCSFolder subscribeUserOrGroup
|
||||||
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: theIdentifier];
|
domain = [[context activeUser] domain];
|
||||||
|
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: theIdentifier
|
||||||
|
inDomain: domain];
|
||||||
|
|
||||||
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
||||||
{
|
{
|
||||||
id <SOGoSource> source;
|
id <SOGoSource> source;
|
||||||
|
|
||||||
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
|
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
|
||||||
if ([source conformsToProtocol:@protocol(MembershipAwareSource)])
|
if ([source conformsToProtocol:@protocol(SOGoMembershipSource)])
|
||||||
{
|
{
|
||||||
NSArray *members = [(id<MembershipAwareSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
|
NSArray *members = [(id<SOGoMembershipSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
|
||||||
allUsers = [NSMutableArray array];
|
allUsers = [NSMutableArray array];
|
||||||
|
|
||||||
for (i = 0; i < [members count]; i++)
|
for (i = 0; i < [members count]; i++)
|
||||||
|
|
|
@ -1624,7 +1624,7 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
iCalPerson *attendee;
|
iCalPerson *attendee;
|
||||||
NSException *ex;
|
NSException *ex;
|
||||||
SOGoUser *ownerUser, *delegatedUser;
|
SOGoUser *ownerUser, *delegatedUser;
|
||||||
NSString *recurrenceTime, *delegatedUid;
|
NSString *recurrenceTime, *delegatedUid, *domain;
|
||||||
|
|
||||||
event = nil;
|
event = nil;
|
||||||
ex = nil;
|
ex = nil;
|
||||||
|
@ -1672,7 +1672,9 @@ inRecurrenceExceptionsForEvent: (iCalEvent *) theEvent
|
||||||
reason: @"delegate is a participant"];
|
reason: @"delegate is a participant"];
|
||||||
else {
|
else {
|
||||||
NSDictionary *dict;
|
NSDictionary *dict;
|
||||||
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: [[delegate email] rfc822Email]];
|
domain = [[context activeUser] domain];
|
||||||
|
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: [[delegate email] rfc822Email]
|
||||||
|
inDomain: domain];
|
||||||
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
||||||
ex = [NSException exceptionWithHTTPStatus: 409
|
ex = [NSException exceptionWithHTTPStatus: 409
|
||||||
reason: @"delegate is a group"];
|
reason: @"delegate is a group"];
|
||||||
|
|
|
@ -549,7 +549,8 @@
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
}
|
}
|
||||||
|
|
||||||
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: [currentAttendee rfc822Email]];
|
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: [currentAttendee rfc822Email]
|
||||||
|
inDomain: domain];
|
||||||
|
|
||||||
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
||||||
{
|
{
|
||||||
|
@ -562,9 +563,9 @@
|
||||||
[allAttendees removeObject: currentAttendee];
|
[allAttendees removeObject: currentAttendee];
|
||||||
|
|
||||||
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
|
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
|
||||||
if ([source conformsToProtocol:@protocol(MembershipAwareSource)])
|
if ([source conformsToProtocol:@protocol(SOGoMembershipSource)])
|
||||||
{
|
{
|
||||||
members = [(id<MembershipAwareSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
|
members = [(id<SOGoMembershipSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
|
||||||
for (i = 0; i < [members count]; i++)
|
for (i = 0; i < [members count]; i++)
|
||||||
{
|
{
|
||||||
user = [members objectAtIndex: i];
|
user = [members objectAtIndex: i];
|
||||||
|
|
|
@ -1424,13 +1424,16 @@ _compareFetchResultsByMODSEQ (id entry1, id entry2, void *data)
|
||||||
|
|
||||||
- (NSString *) _sogoACLUIDToIMAPUID: (NSString *) uid
|
- (NSString *) _sogoACLUIDToIMAPUID: (NSString *) uid
|
||||||
{
|
{
|
||||||
|
NSString *domain;
|
||||||
NSDictionary *dict;
|
NSDictionary *dict;
|
||||||
SOGoUser *user;
|
SOGoUser *user;
|
||||||
|
|
||||||
if ([uid isEqualToString: defaultUserID])
|
if ([uid isEqualToString: defaultUserID])
|
||||||
return uid;
|
return uid;
|
||||||
|
|
||||||
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: uid];
|
domain = [[context activeUser] domain];
|
||||||
|
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: uid
|
||||||
|
inDomain: domain];
|
||||||
|
|
||||||
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
||||||
return [[[[context activeUser] domainDefaults] imapAclGroupIdPrefix]
|
return [[[[context activeUser] domainDefaults] imapAclGroupIdPrefix]
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
@class NSMutableDictionary;
|
@class NSMutableDictionary;
|
||||||
@class NSString;
|
@class NSString;
|
||||||
|
|
||||||
@interface LDAPSource : NSObject <SOGoDNSource, MembershipAwareSource>
|
@interface LDAPSource : NSObject <SOGoDNSource, SOGoMembershipSource>
|
||||||
{
|
{
|
||||||
int _queryLimit;
|
int _queryLimit;
|
||||||
int _queryTimeout;
|
int _queryTimeout;
|
||||||
|
|
|
@ -923,23 +923,25 @@ static NSArray *childRecordFields = nil;
|
||||||
{
|
{
|
||||||
NSMutableDictionary *moduleSettings, *folderShowAlarms;
|
NSMutableDictionary *moduleSettings, *folderShowAlarms;
|
||||||
NSMutableArray *folderSubscription;
|
NSMutableArray *folderSubscription;
|
||||||
NSString *subscriptionPointer;
|
NSString *subscriptionPointer, *domain;
|
||||||
NSMutableArray *allUsers;
|
NSMutableArray *allUsers;
|
||||||
SOGoUserSettings *us;
|
SOGoUserSettings *us;
|
||||||
NSDictionary *dict;
|
NSDictionary *dict;
|
||||||
BOOL rc;
|
BOOL rc;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: theIdentifier];
|
domain = [[context activeUser] domain];
|
||||||
|
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: theIdentifier
|
||||||
|
inDomain: domain];
|
||||||
|
|
||||||
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
||||||
{
|
{
|
||||||
id <SOGoSource> source;
|
id <SOGoSource> source;
|
||||||
|
|
||||||
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
|
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
|
||||||
if ([source conformsToProtocol:@protocol(MembershipAwareSource)])
|
if ([source conformsToProtocol:@protocol(SOGoMembershipSource)])
|
||||||
{
|
{
|
||||||
NSArray *members = [(id<MembershipAwareSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
|
NSArray *members = [(id<SOGoMembershipSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
|
||||||
allUsers = [NSMutableArray array];
|
allUsers = [NSMutableArray array];
|
||||||
|
|
||||||
for (i = 0; i < [members count]; i++)
|
for (i = 0; i < [members count]; i++)
|
||||||
|
@ -1625,7 +1627,7 @@ static NSArray *childRecordFields = nil;
|
||||||
{
|
{
|
||||||
int count, max;
|
int count, max;
|
||||||
NSDictionary *record;
|
NSDictionary *record;
|
||||||
NSString *currentUID;
|
NSString *currentUID, *domain;
|
||||||
NSMutableArray *acls;
|
NSMutableArray *acls;
|
||||||
|
|
||||||
acls = [NSMutableArray array];
|
acls = [NSMutableArray array];
|
||||||
|
@ -1637,12 +1639,14 @@ static NSArray *childRecordFields = nil;
|
||||||
currentUID = [record valueForKey: @"c_uid"];
|
currentUID = [record valueForKey: @"c_uid"];
|
||||||
if ([currentUID hasPrefix: @"@"])
|
if ([currentUID hasPrefix: @"@"])
|
||||||
{
|
{
|
||||||
NSString *dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: currentUID];
|
domain = [[context activeUser] domain];
|
||||||
|
NSString *dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: currentUID
|
||||||
|
inDomain: domain];
|
||||||
if (dict)
|
if (dict)
|
||||||
{
|
{
|
||||||
id <SOGoSource> source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
|
id <SOGoSource> source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
|
||||||
if ([source conformsToProtocol:@protocol(MembershipAwareSource)] &&
|
if ([source conformsToProtocol:@protocol(SOGoMembershipSource)] &&
|
||||||
[(id<MembershipAwareSource>)(source) groupWithUIDHasMemberWithUID: currentUID memberUid: uid])
|
[(id<SOGoMembershipSource>)(source) groupWithUIDHasMemberWithUID: currentUID memberUid: uid])
|
||||||
[acls addObject: [record valueForKey: @"c_role"]];
|
[acls addObject: [record valueForKey: @"c_role"]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1751,7 +1755,7 @@ static NSArray *childRecordFields = nil;
|
||||||
forObjectAtPath: (NSArray *) objectPathArray
|
forObjectAtPath: (NSArray *) objectPathArray
|
||||||
{
|
{
|
||||||
EOQualifier *qualifier;
|
EOQualifier *qualifier;
|
||||||
NSString *uid, *uids, *qs, *objectPath;
|
NSString *uid, *uids, *qs, *objectPath, *domain;
|
||||||
NSMutableArray *usersAndGroups, *groupsMembers;
|
NSMutableArray *usersAndGroups, *groupsMembers;
|
||||||
NSMutableDictionary *aclsForObject;
|
NSMutableDictionary *aclsForObject;
|
||||||
|
|
||||||
|
@ -1766,19 +1770,21 @@ static NSArray *childRecordFields = nil;
|
||||||
NSDictionary *dict;
|
NSDictionary *dict;
|
||||||
|
|
||||||
uid = [usersAndGroups objectAtIndex: i];
|
uid = [usersAndGroups objectAtIndex: i];
|
||||||
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: uid];
|
domain = [[context activeUser] domain];
|
||||||
|
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: uid
|
||||||
|
inDomain: domain];
|
||||||
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
if (dict && [[dict objectForKey: @"isGroup"] boolValue])
|
||||||
{
|
{
|
||||||
id <SOGoSource> source;
|
id <SOGoSource> source;
|
||||||
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
|
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
|
||||||
if ([source conformsToProtocol:@protocol(MembershipAwareSource)])
|
if ([source conformsToProtocol:@protocol(SOGoMembershipSource)])
|
||||||
{
|
{
|
||||||
NSArray *members;
|
NSArray *members;
|
||||||
NSDictionary *user;
|
NSDictionary *user;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
// Fetch members to remove them from the cache along the group
|
// Fetch members to remove them from the cache along the group
|
||||||
members = [(id<MembershipAwareSource>)(source) membersForGroupWithUID: uid];
|
members = [(id<SOGoMembershipSource>)(source) membersForGroupWithUID: uid];
|
||||||
for (j = 0; j < [members count]; j++)
|
for (j = 0; j < [members count]; j++)
|
||||||
{
|
{
|
||||||
user = [members objectAtIndex: j];
|
user = [members objectAtIndex: j];
|
||||||
|
@ -1849,7 +1855,7 @@ static NSArray *childRecordFields = nil;
|
||||||
forUser: (NSString *) uid
|
forUser: (NSString *) uid
|
||||||
forObjectAtPath: (NSArray *) objectPathArray
|
forObjectAtPath: (NSArray *) objectPathArray
|
||||||
{
|
{
|
||||||
NSString *objectPath, *aUID;
|
NSString *objectPath, *aUID, *domain;
|
||||||
NSMutableArray *newRoles;
|
NSMutableArray *newRoles;
|
||||||
|
|
||||||
objectPath = [objectPathArray componentsJoinedByString: @"/"];
|
objectPath = [objectPathArray componentsJoinedByString: @"/"];
|
||||||
|
@ -1861,7 +1867,9 @@ static NSArray *childRecordFields = nil;
|
||||||
if (![uid hasPrefix: @"@"])
|
if (![uid hasPrefix: @"@"])
|
||||||
{
|
{
|
||||||
NSDictionary *dict;
|
NSDictionary *dict;
|
||||||
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: uid];
|
domain = [[context activeUser] domain];
|
||||||
|
dict = [[SOGoUserManager sharedUserManager] contactInfosForUserWithUIDorEmail: uid
|
||||||
|
inDomain: domain];
|
||||||
if ([[dict objectForKey: @"isGroup"] boolValue])
|
if ([[dict objectForKey: @"isGroup"] boolValue])
|
||||||
{
|
{
|
||||||
aUID = [NSString stringWithFormat: @"@%@", uid];
|
aUID = [NSString stringWithFormat: @"@%@", uid];
|
||||||
|
|
|
@ -118,7 +118,7 @@
|
||||||
- (void) updateBaseDNFromLogin: (NSString *) theLogin;
|
- (void) updateBaseDNFromLogin: (NSString *) theLogin;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@protocol MembershipAwareSource <SOGoSource>
|
@protocol SOGoMembershipSource <SOGoSource>
|
||||||
- (NSArray *) membersForGroupWithUID: (NSString *) uid;
|
- (NSArray *) membersForGroupWithUID: (NSString *) uid;
|
||||||
- (BOOL) groupWithUIDHasMemberWithUID: (NSString *) uid
|
- (BOOL) groupWithUIDHasMemberWithUID: (NSString *) uid
|
||||||
memberUid: (NSString *) memberUid;
|
memberUid: (NSString *) memberUid;
|
||||||
|
|
|
@ -407,9 +407,9 @@
|
||||||
|
|
||||||
if ([[dict objectForKey: @"isGroup"] boolValue])
|
if ([[dict objectForKey: @"isGroup"] boolValue])
|
||||||
{
|
{
|
||||||
if ([source conformsToProtocol:@protocol(MembershipAwareSource)])
|
if ([source conformsToProtocol:@protocol(SOGoMembershipSource)])
|
||||||
{
|
{
|
||||||
allUsers = [(id<MembershipAwareSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
|
allUsers = [(id<SOGoMembershipSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
|
||||||
max = [allUsers count];
|
max = [allUsers count];
|
||||||
allUsersData = [NSMutableArray arrayWithCapacity: max];
|
allUsersData = [NSMutableArray arrayWithCapacity: max];
|
||||||
for (i = 0; i < max; i++)
|
for (i = 0; i < max; i++)
|
||||||
|
|
Loading…
Reference in New Issue