fix(addressbook): Removed SOGoGlobalAddressBookFirstEntries (use listRequiresDot instead) and move SOGoGlobalAddressBookFirstEntriesCount to globalAddressBookFirstEntriesCount in source scope. This fixed the broken listRequiresDot in 5.10

This commit is contained in:
smizrahi
2024-02-26 15:40:49 +01:00
parent 776a798e17
commit 4dba56f70d
9 changed files with 67 additions and 62 deletions

View File

@@ -835,12 +835,6 @@ specified as an array of dictionaries.
|S |SOGoURLEncryptionPassphrase
|Passphrase for `SOGoURLEncryptionEnabled`. The string must be 128 bits (16 characters). If this settings change, the cache server must be restarted, and the DAV url will change. Default value is `SOGoSuperSecret0`.
|S |SOGoGlobalAddressBookFirstEntries
|Display first entries in Global Address Book. Default value is `NO`. If source is LDAP, the LDAP overlay `sssvlv` must be enabled on the system for server side sorting.
|S |SOGoGlobalAddressBookFirstEntriesCount
|Number of entries displayed when `SOGoGlobalAddressBookFirstEntries` is enabled. Default value is `100`.
|=======================================================================
@@ -1273,6 +1267,9 @@ repository
|If set to `YES`, listing of this LDAP source is only possible when performing a search (respecting the SOGoSearchMinimumWordLength parameter) or when explicitly typing a single dot.
Defaults to `YES` when unset.
|globalAddressBookFirstEntriesCount (optional)
|Number of entries displayed when `listRequiresDot` is enabled. Default value is `-1` (all records). If source is LDAP, the LDAP overlay sssvlv must be enabled on the system for server side sorting.
|ModulesConstraints (optional)
|Limits the access of any module through a constraint based on an LDAP
attribute; must be a dictionary with keys `Mail`, and/or `Calendar`,

View File

@@ -127,6 +127,11 @@
return [source listRequiresDot];
}
- (BOOL) globalAddressBookFirstEntriesCount
{
return [source globalAddressBookFirstEntriesCount];
}
- (NSString *) groupDavResourceType
{
return @"vcard-collection";
@@ -433,45 +438,33 @@
{
NSArray *records, *result;
EOSortOrdering *ordering;
BOOL processed;
result = nil;
processed = NO;
[source setListRequiresDot: NO];
if ( ![source listRequiresDot])
{
if ([filter length] > 0) {
records = [source fetchContactsMatching: filter
withCriteria: criteria
inDomain: domain];
processed = YES;
} else if ([[SOGoSystemDefaults sharedSystemDefaults] globalAddressBookFirstEntriesEnabled]) {
records = [source fetchContactsMatching: filter
withCriteria: criteria
inDomain: domain
limit: [[SOGoSystemDefaults sharedSystemDefaults] globalAddressBookFirstEntriesCount]];
processed = YES;
}
if (![source listRequiresDot]) {
records = [source fetchContactsMatching: filter
withCriteria: criteria
inDomain: domain
limit: [source globalAddressBookFirstEntriesCount]];
} else {
records = [source fetchContactsMatching: filter
withCriteria: criteria
inDomain: domain];
if (processed) {
[childRecords setObjects: records
forKeys: [records objectsForKey: @"c_name"
notFoundMarker: nil]];
records = [self _flattenedRecords: records];
ordering
= [EOSortOrdering sortOrderingWithKey: sortKey
selector: ((sortOrdering == NSOrderedDescending)
? EOCompareCaseInsensitiveDescending
: EOCompareCaseInsensitiveAscending)];
result
= [records sortedArrayUsingKeyOrderArray:
[NSArray arrayWithObject: ordering]];
}
}
}
[childRecords setObjects: records
forKeys: [records objectsForKey: @"c_name"
notFoundMarker: nil]];
records = [self _flattenedRecords: records];
ordering
= [EOSortOrdering sortOrderingWithKey: sortKey
selector: ((sortOrdering == NSOrderedDescending)
? EOCompareCaseInsensitiveDescending
: EOCompareCaseInsensitiveAscending)];
result
= [records sortedArrayUsingKeyOrderArray:
[NSArray arrayWithObject: ordering]];
return result;
}

View File

@@ -64,6 +64,7 @@
NSArray *_bindFields;
BOOL _listRequiresDot;
int _globalAddressBookFirstEntriesCount;
NSString *_domain;
NSString *_contactInfoAttribute;

View File

@@ -106,6 +106,7 @@ static Class NSStringK;
_filter = nil;
_userPasswordAlgorithm = nil;
_listRequiresDot = YES;
_globalAddressBookFirstEntriesCount = -1;
_passwordPolicy = NO;
_updateSambaNTLMPasswords = NO;
@@ -200,10 +201,15 @@ static Class NSStringK;
andMultipleBookingsField: [udSource objectForKey: @"MultipleBookingsFieldName"]];
dotValue = [udSource objectForKey: @"listRequiresDot"];
if (dotValue)
if (dotValue) {
[self setListRequiresDot: [dotValue boolValue]];
if ([udSource objectForKey: @"globalAddressBookFirstEntriesCount"])
[self setGlobalAddressBookFirstEntriesCount: [[udSource objectForKey: @"globalAddressBookFirstEntriesCount"] intValue]];
}
[self setContactMapping: [udSource objectForKey: @"mapping"]
andObjectClasses: [udSource objectForKey: @"objectClasses"]];
[self setModifiers: [udSource objectForKey: @"modifiers"]];
ASSIGN(_abOU, [udSource objectForKey: @"abOU"]);
@@ -400,6 +406,16 @@ groupObjectClasses: (NSArray *) newGroupObjectClasses
return _listRequiresDot;
}
- (void) setGlobalAddressBookFirstEntriesCount: (int)value
{
_globalAddressBookFirstEntriesCount = value;
}
- (int) globalAddressBookFirstEntriesCount
{
return _globalAddressBookFirstEntriesCount;
}
- (NSArray *) searchFields
{
return _searchFields;

View File

@@ -49,6 +49,8 @@
/* requires a "." to obtain the full list of contacts */
- (void) setListRequiresDot: (BOOL) aBool;
- (BOOL) listRequiresDot;
- (void) setGlobalAddressBookFirstEntriesCount: (int)value;
- (int) globalAddressBookFirstEntriesCount;
- (BOOL) checkLogin: (NSString *) _login
password: (NSString *) _pwd

View File

@@ -135,9 +135,6 @@ NSComparisonResult languageSort(id el1, id el2, void *context);
- (NSArray *) disableSharingAnyAuthUser;
- (NSArray *) disableExport;
- (BOOL) enableGlobalAddressBookFirstEntries;
- (int) globalAddressBookFirstEntriesCount;
- (BOOL)isURLEncryptionEnabled;
- (NSString *)urlEncryptionPassphrase;

View File

@@ -917,21 +917,4 @@ NSComparisonResult languageSort(id el1, id el2, void *context)
return disableExport;
}
- (BOOL) globalAddressBookFirstEntriesEnabled
{
return [self boolForKey: @"SOGoGlobalAddressBookFirstEntries"];
}
- (int) globalAddressBookFirstEntriesCount
{
int v;
v = [self integerForKey: @"SOGoGlobalAddressBookFirstEntriesCount"];
if (!v)
v = 100;
return v;
}
@end

View File

@@ -52,6 +52,7 @@
NSString *_multipleBookingsField;
BOOL _listRequiresDot;
int _globalAddressBookFirstEntriesCount;
NSDictionary *_modulesConstraints;
}

View File

@@ -108,6 +108,7 @@
_imapHostField = nil;
_sieveHostField = nil;
_listRequiresDot = YES;
_globalAddressBookFirstEntriesCount = -1;
_modulesConstraints = nil;
}
@@ -170,8 +171,12 @@
_viewURL = [[NSURL alloc] initWithString: [udSource objectForKey: @"viewURL"]];
dotValue = [udSource objectForKey: @"listRequiresDot"];
if (dotValue)
if (dotValue) {
[self setListRequiresDot: [dotValue boolValue]];
if ([udSource objectForKey: @"globalAddressBookFirstEntriesCount"])
[self setGlobalAddressBookFirstEntriesCount: [[udSource objectForKey: @"globalAddressBookFirstEntriesCount"] intValue]];
}
#warning this domain code has no effect yet
if ([sourceDomain length])
@@ -1156,6 +1161,16 @@
return _listRequiresDot;
}
- (void) setGlobalAddressBookFirstEntriesCount: (int)value
{
_globalAddressBookFirstEntriesCount = value;
}
- (int) globalAddressBookFirstEntriesCount
{
return _globalAddressBookFirstEntriesCount;
}
/* card editing */
- (void) setModifiers: (NSArray *) newModifiers
{