Remove listRequiresDot option from *Source classes

This option is not needed. SQLSource was not using it
and LDAPSource will transform the filter to (UIDField=*) when
there is nothing set as filter, before this patch it was needed
to either insert '.' as filter or set listRequiresDot to NO
This commit is contained in:
Jesús García Sáez 2016-01-20 11:01:27 +01:00
parent 169356b8a0
commit 6b2ec7a2e7
5 changed files with 28 additions and 77 deletions

View file

@ -353,26 +353,15 @@
NSArray *records, *result; NSArray *records, *result;
EOSortOrdering *ordering; EOSortOrdering *ordering;
result = nil; records = [source fetchContactsMatching: filter inDomain: domain];
[childRecords setObjects: records forKeys: [records objectsForKey: @"c_name"
if (([filter length] > 0 && [criteria isEqualToString: @"name_or_address"]) notFoundMarker: nil]];
|| ![source listRequiresDot]) records = [self _flattenedRecords: records];
{ ordering = [EOSortOrdering sortOrderingWithKey: sortKey
records = [source fetchContactsMatching: filter selector: ((sortOrdering == NSOrderedDescending)
inDomain: domain]; ? EOCompareCaseInsensitiveDescending
[childRecords setObjects: records : EOCompareCaseInsensitiveAscending)];
forKeys: [records objectsForKey: @"c_name" result = [records sortedArrayUsingKeyOrderArray: [NSArray arrayWithObject: ordering]];
notFoundMarker: nil]];
records = [self _flattenedRecords: records];
ordering
= [EOSortOrdering sortOrderingWithKey: sortKey
selector: ((sortOrdering == NSOrderedDescending)
? EOCompareCaseInsensitiveDescending
: EOCompareCaseInsensitiveAscending)];
result
= [records sortedArrayUsingKeyOrderArray:
[NSArray arrayWithObject: ordering]];
}
return result; return result;
} }

View file

@ -65,8 +65,6 @@
NSString *SieveHostField; NSString *SieveHostField;
NSArray *bindFields; NSArray *bindFields;
BOOL listRequiresDot;
NSString *domain; NSString *domain;
NSString *contactInfoAttribute; NSString *contactInfoAttribute;

View file

@ -110,7 +110,6 @@ static Class NSStringK;
_scope = @"sub"; _scope = @"sub";
_filter = nil; _filter = nil;
_userPasswordAlgorithm = nil; _userPasswordAlgorithm = nil;
listRequiresDot = YES;
searchAttributes = nil; searchAttributes = nil;
passwordPolicy = NO; passwordPolicy = NO;
@ -201,9 +200,6 @@ static Class NSStringK;
kindField: [udSource objectForKey: @"KindFieldName"] kindField: [udSource objectForKey: @"KindFieldName"]
andMultipleBookingsField: [udSource objectForKey: @"MultipleBookingsFieldName"]]; andMultipleBookingsField: [udSource objectForKey: @"MultipleBookingsFieldName"]];
dotValue = [udSource objectForKey: @"listRequiresDot"];
if (dotValue)
[self setListRequiresDot: [dotValue boolValue]];
[self setContactMapping: [udSource objectForKey: @"mapping"] [self setContactMapping: [udSource objectForKey: @"mapping"]
andObjectClasses: [udSource objectForKey: @"objectClasses"]]; andObjectClasses: [udSource objectForKey: @"objectClasses"]];
@ -371,16 +367,6 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
ASSIGN(multipleBookingsField, [newMultipleBookingsField lowercaseString]); ASSIGN(multipleBookingsField, [newMultipleBookingsField lowercaseString]);
} }
- (void) setListRequiresDot: (BOOL) aBool
{
listRequiresDot = aBool;
}
- (BOOL) listRequiresDot
{
return listRequiresDot;
}
- (void) setContactMapping: (NSDictionary *) newMapping - (void) setContactMapping: (NSDictionary *) newMapping
andObjectClasses: (NSArray *) newObjectClasses andObjectClasses: (NSArray *) newObjectClasses
{ {
@ -790,15 +776,13 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
qualifier = [EOQualifier qualifierWithQualifierFormat: qs]; qualifier = [EOQualifier qualifierWithQualifierFormat: qs];
} }
else if (!listRequiresDot) else
{ {
qs = [NSMutableString stringWithFormat: @"(%@='*')", CNField]; qs = [NSMutableString stringWithFormat: @"(%@='*')", CNField];
if ([_filter length]) if ([_filter length])
[qs appendFormat: @" AND %@", _filter]; [qs appendFormat: @" AND %@", _filter];
qualifier = [EOQualifier qualifierWithQualifierFormat: qs]; qualifier = [EOQualifier qualifierWithQualifierFormat: qs];
} }
else
qualifier = nil;
return qualifier; return qualifier;
} }
@ -1189,29 +1173,25 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
contacts = [NSMutableArray array]; contacts = [NSMutableArray array];
if ([match length] > 0 || !listRequiresDot) ldapConnection = [self _ldapConnection];
{ qualifier = [self _qualifierForFilter: match];
ldapConnection = [self _ldapConnection]; // attributes = [self _searchAttributes];
qualifier = [self _qualifierForFilter: match]; attributes = [NSArray arrayWithObject: @"*"];
// attributes = [self _searchAttributes];
attributes = [NSArray arrayWithObject: @"*"];
if ([_scope caseInsensitiveCompare: @"BASE"] == NSOrderedSame) if ([_scope caseInsensitiveCompare: @"BASE"] == NSOrderedSame)
entries = [ldapConnection baseSearchAtBaseDN: baseDN entries = [ldapConnection baseSearchAtBaseDN: baseDN
qualifier: qualifier qualifier: qualifier
attributes: attributes]; attributes: attributes];
else if ([_scope caseInsensitiveCompare: @"ONE"] == NSOrderedSame) else if ([_scope caseInsensitiveCompare: @"ONE"] == NSOrderedSame)
entries = [ldapConnection flatSearchAtBaseDN: baseDN entries = [ldapConnection flatSearchAtBaseDN: baseDN
qualifier: qualifier qualifier: qualifier
attributes: attributes]; attributes: attributes];
else /* we do it like before */ else /* we do it like before */
entries = [ldapConnection deepSearchAtBaseDN: baseDN entries = [ldapConnection deepSearchAtBaseDN: baseDN
qualifier: qualifier qualifier: qualifier
attributes: attributes]; attributes: attributes];
while ((currentEntry = [entries nextObject])) while ((currentEntry = [entries nextObject]))
[contacts addObject: [contacts addObject: [self _convertLDAPEntryToContact: currentEntry]];
[self _convertLDAPEntryToContact: currentEntry]];
}
return contacts; return contacts;
} }
@ -1721,7 +1701,6 @@ _makeLDAPChanges (NGLdapConnection *ldapConnection,
bindFields: nil bindFields: nil
kindField: nil kindField: nil
andMultipleBookingsField: nil]; andMultipleBookingsField: nil];
[ab setListRequiresDot: NO];
[ab setModifiers: modifier]; [ab setModifiers: modifier];
[sources addObject: ab]; [sources addObject: ab];
[ab release]; [ab release];

View file

@ -41,10 +41,6 @@
- (NSString *) domain; - (NSString *) domain;
/* requires a "." to obtain the full list of contacts */
- (void) setListRequiresDot: (BOOL) aBool;
- (BOOL) listRequiresDot;
- (BOOL) checkLogin: (NSString *) _login - (BOOL) checkLogin: (NSString *) _login
password: (NSString *) _pwd password: (NSString *) _pwd
perr: (SOGoPasswordPolicyError *) _perr perr: (SOGoPasswordPolicyError *) _perr

View file

@ -851,17 +851,6 @@
return _sourceID; return _sourceID;
} }
- (void) setListRequiresDot: (BOOL) newListRequiresDot
{
}
- (BOOL) listRequiresDot
{
/* This method is not implemented for SQLSource. It must enable a mechanism
where using "." is not required to list the content of addressbooks. */
return YES;
}
/* card editing */ /* card editing */
- (void) setModifiers: (NSArray *) newModifiers - (void) setModifiers: (NSArray *) newModifiers
{ {