feat(carddav): fix issue where only personal contacts can be synced on macOS (#1981). When , append the addressbook name as a username suffix to force macOS to treat each book as a distinct account. Usernames must not contain . Install via the provisioning profile. Closes #6033.

This commit is contained in:
smizrahi
2026-05-11 14:21:35 +02:00
parent d16a1a9708
commit 761934af42
13 changed files with 136 additions and 9 deletions
+21 -1
View File
@@ -32,6 +32,7 @@
#import <SOGo/NSObject+DAV.h>
#import <SOGo/SOGoUser.h>
#import <SOGo/SOGoUserFolder.h>
#import <SOGo/SOGoUserManager.h>
#import <SOGo/SOGoSystemDefaults.h>
#import <SOGo/WORequest+SOGo.h>
@@ -299,8 +300,27 @@ Class SOGoContactSourceFolderK;
- (NSArray *) toManyRelationshipKeys
{
NSMutableArray *keys;
SOGoSystemDefaults *sd;
if ([[context request] isMacOSXAddressBookApp])
sd = [SOGoSystemDefaults sharedSystemDefaults];
/* Per-addressbook CardDAV profile: when enabled and the parent user folder
is reached through a /dav/<user>!<book>/ alias URL, expose only that
book. The legacy macOS "personal only" shortcut below is also gated on
the flag so the two mechanisms don't overlap. */
if ([sd carddavSingleAddressBookProfile])
{
NSString *parentName;
NSRange separator;
parentName = [[self lookupUserFolder] nameInContainer];
separator = [parentName rangeOfString: @"!"];
if (separator.location != NSNotFound)
return [NSArray arrayWithObject:
[parentName substringFromIndex: separator.location + 1]];
}
if ([[context request] isMacOSXAddressBookApp]
&& ![sd carddavSingleAddressBookProfile])
keys = [NSMutableArray arrayWithObject: @"personal"];
else
keys = (NSMutableArray *) [super toManyRelationshipKeys];