Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression from commit b8595d7 (#5043) #284

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions SoObjects/Appointments/SOGoAppointmentFolder.m
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,6 @@ - (BOOL) subscribeUserOrGroup: (NSString *) theIdentifier
NSString *subscriptionPointer, *domain;
NSMutableArray *allUsers;
SOGoUserSettings *us;
SOGoUser *sogoUser;
NSDictionary *dict;
BOOL rc;
int i;
Expand All @@ -453,11 +452,15 @@ - (BOOL) subscribeUserOrGroup: (NSString *) theIdentifier
NSArray *members;

members = [(id<SOGoMembershipSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
allUsers = [NSMutableArray arrayWithArray: members];
allUsers = [NSMutableArray array];

for (i = 0; i < [members count]; i++)
{
[allUsers addObject: [[members objectAtIndex: i] 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]];
[allUsers removeObject: [[context activeUser] login]];
}
else
{
Expand All @@ -467,17 +470,15 @@ - (BOOL) subscribeUserOrGroup: (NSString *) theIdentifier
}
else
{
sogoUser = [SOGoUser userWithLogin: theIdentifier roles: nil];
if (sogoUser)
allUsers = [NSArray arrayWithObject: sogoUser];
if (dict)
allUsers = [NSArray arrayWithObject: [dict objectForKey: @"c_uid"]];
else
allUsers = [NSArray array];
}

for (i = 0; i < [allUsers count]; i++)
{
sogoUser = [allUsers objectAtIndex: i];
us = [sogoUser userSettings];
us = [SOGoUserSettings settingsForUser: [allUsers objectAtIndex: i]];
moduleSettings = [us objectForKey: [container nameInContainer]];
if (!(moduleSettings
&& [moduleSettings isKindOfClass: [NSMutableDictionary class]]))
Expand Down Expand Up @@ -1519,7 +1520,7 @@ - (NSArray *) fetchFields: (NSArray *) _fields
BOOL rememberRecords, canCycle;
SOGoUser *ownerUser;

ownerUser = [SOGoUser userWithLogin: self->owner roles: nil];
ownerUser = [SOGoUser userWithLogin: owner roles: nil];
rememberRecords = [self _checkIfWeCanRememberRecords: _fields];
canCycle = [_component isEqualToString: @"vevent"] || [_component isEqualToString: @"vtodo"];
// if (rememberRecords)
Expand Down Expand Up @@ -1677,7 +1678,7 @@ - (NSArray *) fetchFields: (NSArray *) _fields
}

currentLogin = [[context activeUser] login];
if (![currentLogin isEqualToString: self->owner])
if (![currentLogin isEqualToString: owner])
{

if (!_includeProtectedInformation)
Expand Down
6 changes: 3 additions & 3 deletions SoObjects/Appointments/SOGoCalendarComponent.m
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ - (BOOL) expandGroupsInEvent: (iCalEvent *) theEvent
{
iCalPerson *person;
NSArray *members;
SOGoUser *user;
NSDictionary *user;
id <SOGoSource> source;

// We did decompose a group...
Expand All @@ -574,10 +574,10 @@ - (BOOL) expandGroupsInEvent: (iCalEvent *) theEvent

// If the organizer is part of the group, we skip it from
// the addition to the attendees' list
if ([user hasEmail: organizerEmail])
if ([[user objectForKey: @"c_emails"] containsObject: organizerEmail])
continue;

person = [self iCalPersonWithUID: [user login]];
person = [self iCalPersonWithUID: [user objectForKey: @"c_uid"]];
[person setTag: @"ATTENDEE"];
[person setParticipationStatus: [currentAttendee participationStatus]];
[person setRsvp: [currentAttendee rsvp]];
Expand Down
11 changes: 8 additions & 3 deletions SoObjects/SOGo/LDAPSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -2085,7 +2085,9 @@ - (NSArray *) membersForGroupWithUID: (NSString *) uid
if (user)
{
[logins addObject: login];
[members addObject: user];
[members addObject: [NSDictionary dictionaryWithObjectsAndKeys: login, @"c_uid",
[user cn], @"c_cn",
[user allEmails], @"c_emails", nil]];
}
[pool release];
}
Expand All @@ -2101,21 +2103,24 @@ - (NSArray *) membersForGroupWithUID: (NSString *) uid
contactInfos = [self lookupContactEntryWithUIDorEmail: login inDomain: nil];
if ([contactInfos objectForKey: @"isGroup"])
{
#warning Potential endless recursion due to cyclic memberships
users = [self membersForGroupWithUID: login];
[members addObjectsFromArray: users];
}
else
{
[logins addObject: login];
[members addObject: user];
[members addObject: [NSDictionary dictionaryWithObjectsAndKeys: login, @"c_uid",
[user cn], @"c_cn",
[user allEmails], @"c_emails", nil]];
}
}
[pool release];
}


// We are done fetching members, let's cache the members of the group
// (ie., their UIDs) in memcached to speed up -groupWithUIDHasMemberWithUID.
// (ie., their UIDs) in memcached to speed up -hasMemberWithUID.
[[SOGoCache sharedCache] setValue: [logins componentsJoinedByString: @","]
forKey: [NSString stringWithFormat: @"%@+%@", uid, _domain]];
}
Expand Down
21 changes: 11 additions & 10 deletions SoObjects/SOGo/SOGoGCSFolder.m
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,6 @@ - (BOOL) subscribeUserOrGroup: (NSString *) theIdentifier
NSString *subscriptionPointer, *domain;
NSMutableArray *allUsers;
SOGoUserSettings *us;
SOGoUser *sogoUser;
NSDictionary *dict;
BOOL rc;
int i;
Expand All @@ -945,11 +944,15 @@ - (BOOL) subscribeUserOrGroup: (NSString *) theIdentifier
NSArray *members;

members = [(id<SOGoMembershipSource>)(source) membersForGroupWithUID: [dict objectForKey: @"c_uid"]];
allUsers = [NSMutableArray arrayWithArray: members];
allUsers = [NSMutableArray array];

for (i = 0; i < [members count]; i++)
{
[allUsers addObject: [[members objectAtIndex: i] 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]];
[allUsers removeObject: [[context activeUser] login]];
}
else
{
Expand All @@ -959,9 +962,8 @@ - (BOOL) subscribeUserOrGroup: (NSString *) theIdentifier
}
else
{
sogoUser = [SOGoUser userWithLogin: theIdentifier roles: nil];
if (sogoUser)
allUsers = [NSArray arrayWithObject: sogoUser];
if (dict)
allUsers = [NSArray arrayWithObject: [dict objectForKey: @"c_uid"]];
else
allUsers = [NSArray array];
}
Expand All @@ -974,8 +976,7 @@ - (BOOL) subscribeUserOrGroup: (NSString *) theIdentifier

for (i = 0; i < [allUsers count]; i++)
{
sogoUser = [allUsers objectAtIndex: i];
us = [sogoUser userSettings];
us = [SOGoUserSettings settingsForUser: [allUsers objectAtIndex: i]];
moduleSettings = [us objectForKey: [container nameInContainer]];
if (!(moduleSettings
&& [moduleSettings isKindOfClass: [NSMutableDictionary class]]))
Expand Down Expand Up @@ -1797,16 +1798,16 @@ - (void) removeAclsForUsers: (NSArray *) users
source = [[SOGoUserManager sharedUserManager] sourceWithID: [dict objectForKey: @"SOGoSource"]];
if ([source conformsToProtocol:@protocol(SOGoMembershipSource)])
{
NSDictionary *user;
NSArray *members;
SOGoUser *user;
unsigned int j;

// Fetch members to remove them from the cache along the group
members = [(id<SOGoMembershipSource>)(source) membersForGroupWithUID: uid];
for (j = 0; j < [members count]; j++)
{
user = [members objectAtIndex: j];
[groupsMembers addObject: [user login]];
[groupsMembers addObject: [user objectForKey: @"c_uid"]];
}

if (![uid hasPrefix: @"@"])
Expand Down
8 changes: 4 additions & 4 deletions UI/Contacts/UIxContactView.m
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ - (NSArray *) deliveryAddresses
NSString *email;
SOGoObject <SOGoContactObject> *contact;
SOGoObject <SOGoSource> *source;
SOGoUser *user;
NSDictionary *user;
id <WOActionResults> result;
unsigned int i, max;

Expand All @@ -418,14 +418,14 @@ - (NSArray *) deliveryAddresses
{
user = [allUsers objectAtIndex: i];
allUserEmails = [NSMutableArray array];
emails = [[user allEmails] objectEnumerator];
emails = [[user objectForKey: @"c_emails"] objectEnumerator];
while ((email = [emails nextObject])) {
[allUserEmails addObject: [NSDictionary dictionaryWithObjectsAndKeys:
email, @"value", @"work", @"type", nil]];
}
userData = [NSDictionary dictionaryWithObjectsAndKeys:
[user loginInDomain], @"c_uid",
[user cn], @"c_cn",
[user objectForKey: @"c_uid"], @"c_uid",
[user objectForKey: @"c_cn"], @"c_cn",
allUserEmails, @"emails", nil];
[allUsersData addObject: userData];
}
Expand Down