Monotone-Parent: 4f981df6c4bdc933e2028d7a0ac984e74762dcb0

Monotone-Revision: f4d36201867e3633e57d99b75ebd377af0a7a8bb

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2010-04-23T16:29:35
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2010-04-23 16:29:35 +00:00
parent 32eda4b841
commit 392b300a02
3 changed files with 19 additions and 2 deletions

View File

@@ -3,6 +3,9 @@
* Tools/SOGoSockDOperation.m (-_performSearch): we now support an
additional identifier in the object DN, for specifying specific
objects.
(_appendEntry:toResult:): we take the additional particle into
account when building the dn. Also, we add the "uid" field for
LDAP compliance.
* SoObjects/Contacts/SOGoContactSourceFolder.m
(_flattenedRecord:): new method with the repetitive code from

View File

@@ -31,6 +31,7 @@
{
NSDictionary *parameters;
NSArray *resultEntries;
BOOL singleEntryOperation;
int resultCode;
}

View File

@@ -36,6 +36,8 @@
#import "SOGoSockDOperation.h"
Class SOGoContactSourceFolderKlass = Nil;
@interface _SOGoSockDOperationSearch : SOGoSockDOperation
@end
@@ -48,6 +50,8 @@
{
[[SOGoProductLoader productLoader]
loadProducts: [NSArray arrayWithObjects: @"Contacts.SOGo", nil]];
SOGoContactSourceFolderKlass
= NSClassFromString (@"SOGoContactSourceFolder");
}
+ (SOGoSockDOperation *) operationWithMethod: (NSString *) method
@@ -101,9 +105,13 @@
[ldifFields retain];
}
[result appendFormat: @"dn: cn=%@,%@\n",
[entry objectForKey: @"c_name"], [parameters objectForKey: @"suffix"]];
if (singleEntryOperation)
[result appendFormat: @"dn: %@\n", [parameters objectForKey: @"base"]];
else
[result appendFormat: @"dn: uid=%@,%@\n", [entry objectForKey: @"c_name"],
[parameters objectForKey: @"base"]];
[result appendString: @"objectClass: person\nobjectClass: inetOrgPerson\n"];
[result appendFormat: @"uid: %@\n", [entry objectForKey: @"c_name"]];
max = [ldifFields count];
for (count = 0; count < max; count++)
@@ -254,8 +262,12 @@
{
if (idCount == 1)
{
singleEntryOperation = NO;
filter = [self _convertLDAPFilter:
[parameters objectForKey: @"filter"]];
if ([filter length] == 0
&& [folder isKindOfClass: SOGoContactSourceFolderKlass])
filter = @".";
resultEntries
= [folder lookupContactsWithFilter: filter
sortBy: @"c_cn"
@@ -263,6 +275,7 @@
}
else
{
singleEntryOperation = YES;
singleEntry = [folder lookupContactWithName:
[dnIDs objectAtIndex: 0]];
resultEntries = [NSArray arrayWithObject: singleEntry];