See Changelog.

Monotone-Parent: 7644c155b02b86d417852ac59361714181ec8c18
Monotone-Revision: 66faeac6511d176fd1b35b6a0a5b8cbb20b0b2d1

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2011-01-24T18:02:12
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Francis Lachapelle
2011-01-24 18:02:12 +00:00
parent 84c08b964a
commit c33821349e
4 changed files with 40 additions and 14 deletions
+8
View File
@@ -1,3 +1,11 @@
2011-01-24 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/SOGo/LDAPSource.m (_qualifierForFilter:): added
support for the parameter "SearchFieldNames" that can be added to
the source defaults to specify which LDAP attributes to use when
filtering contacts. It defaults to the previous values, ie sn,
displayname, and telephonenumber.
2011-01-21 Francis Lachapelle <flachapelle@inverse.ca>
* SoObjects/Appointments/iCalRepeatableEntityObject+SOGo.m
+3 -2
View File
@@ -1,6 +1,6 @@
/* LDAPSource.h - this file is part of SOGo
*
* Copyright (C) 2007-2010 Inverse inc.
* Copyright (C) 2007-2011 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Ludovic Marcotte <lmarcotte@inverse.ca>
@@ -52,7 +52,7 @@
NSString *IDField; /* the first part of a user DN */
NSString *CNField;
NSString *UIDField;
NSArray *mailFields;
NSArray *mailFields, *searchFields;
NSString *IMAPHostField;
NSArray *bindFields;
BOOL _bindAsCurrentUser;
@@ -81,6 +81,7 @@
CNField: (NSString *) newCNField
UIDField: (NSString *) newUIDField
mailFields: (NSArray *) newMailFields
searchFields: (NSArray *) newSearchFields
IMAPHostField: (NSString *) newIMAPHostField
andBindFields: (id) newBindFields;
+25 -11
View File
@@ -1,6 +1,6 @@
/* LDAPSource.m - this file is part of SOGo
*
* Copyright (C) 2007-2010 Inverse inc.
* Copyright (C) 2007-2011 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Ludovic Marcotte <lmarcotte@inverse.ca>
@@ -158,6 +158,8 @@ static NSArray *commonSearchFields;
UIDField = @"uid";
mailFields = [NSArray arrayWithObject: @"mail"];
[mailFields retain];
searchFields = [NSArray arrayWithObjects: @"sn", @"displayname", @"telephonenumber", nil];
[searchFields retain];
IMAPHostField = nil;
bindFields = nil;
_scope = @"sub";
@@ -184,6 +186,7 @@ static NSArray *commonSearchFields;
[CNField release];
[UIDField release];
[mailFields release];
[searchFields release];
[IMAPHostField release];
[bindFields release];
[_filter release];
@@ -218,6 +221,7 @@ static NSArray *commonSearchFields;
CNField: [udSource objectForKey: @"CNFieldName"]
UIDField: [udSource objectForKey: @"UIDFieldName"]
mailFields: [udSource objectForKey: @"MailFieldNames"]
searchFields: [udSource objectForKey: @"SearchFieldNames"]
IMAPHostField: [udSource objectForKey: @"IMAPHostFieldName"]
andBindFields: [udSource objectForKey: @"bindFields"]];
@@ -299,6 +303,7 @@ static NSArray *commonSearchFields;
CNField: (NSString *) newCNField
UIDField: (NSString *) newUIDField
mailFields: (NSArray *) newMailFields
searchFields: (NSArray *) newSearchFields
IMAPHostField: (NSString *) newIMAPHostField
andBindFields: (id) newBindFields
{
@@ -313,6 +318,8 @@ static NSArray *commonSearchFields;
ASSIGN (IMAPHostField, newIMAPHostField);
if (newMailFields)
ASSIGN (mailFields, newMailFields);
if (newSearchFields)
ASSIGN (searchFields, newSearchFields);
if (newBindFields)
{
// Before SOGo v1.2.0, bindFields was a comma-separated list
@@ -580,28 +587,35 @@ static NSArray *commonSearchFields;
}
/* contact management */
/**
* Search for contacts matching some string.
* @param filter The string to search for
* @see fetchContactsMatching:
* @return A EOQualifier matching the filter
*/
- (EOQualifier *) _qualifierForFilter: (NSString *) filter
{
NSString *mailFormat, *fieldFormat, *escapedFilter;
NSMutableArray *fields;
NSString *searchFormat, *fieldFormat, *escapedFilter;
EOQualifier *qualifier;
NSMutableString *qs;
escapedFilter = SafeLDAPCriteria(filter);
if ([escapedFilter length] > 0)
{
fieldFormat = [NSString stringWithFormat: @"(%%@='%@*')", escapedFilter];
mailFormat = [[mailFields stringsWithFormat: fieldFormat]
componentsJoinedByString: @" OR "];
qs = [NSMutableString string];
if ([escapedFilter isEqualToString: @"."])
[qs appendFormat: @"(%@='*')", CNField];
else
[qs appendFormat: @"(%@='%@*') OR (sn='%@*') OR (displayName='%@*')"
@"OR %@ OR (telephoneNumber='*%@*')",
CNField, escapedFilter, escapedFilter, escapedFilter, mailFormat,
escapedFilter];
{
fieldFormat = [NSString stringWithFormat: @"(%%@='%@*')", escapedFilter];
fields = [NSMutableArray arrayWithArray: searchFields];
[fields addObjectsFromArray: mailFields];
searchFormat = [[[fields uniqueObjects] stringsWithFormat: fieldFormat]
componentsJoinedByString: @" OR "];
[qs appendFormat: @"(%@='%@*') OR %@",
CNField, escapedFilter, searchFormat];
}
if (_filter && [_filter length])
[qs appendFormat: @" AND %@", _filter];
+4 -1
View File
@@ -1,6 +1,6 @@
/* SOGoUserManager.m - this file is part of SOGo
*
* Copyright (C) 2007-2010 Inverse inc.
* Copyright (C) 2007-2011 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
*
@@ -132,6 +132,9 @@
value = [udSource objectForKey: @"MailFieldNames"];
if (value)
[metadata setObject: value forKey: @"MailFieldNames"];
value = [udSource objectForKey: @"SearchFieldNames"];
if (value)
[metadata setObject: value forKey: @"SearchFieldNames"];
[_sourcesMetadata setObject: metadata forKey: sourceID];
}
else