From 0e6fd77ffe2fba0a12845d8dd6e69aa02f3da4e1 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 27 Apr 2016 13:27:22 +0000 Subject: [PATCH] * CardDAV: fix not working creation of new CardDAV account with OS X 10.11.4 addressbook (it stays empty) OS X 10.11.4 addressbook does a propfind for "addressbook-home-set" and "directory-gateway" in the root and does not continue without it --- .../inc/class.addressbook_groupdav.inc.php | 17 +++++++++++++++++ addressbook/setup/setup.inc.php | 1 + 2 files changed, 18 insertions(+) diff --git a/addressbook/inc/class.addressbook_groupdav.inc.php b/addressbook/inc/class.addressbook_groupdav.inc.php index 25c2aab4a7..652554fb85 100644 --- a/addressbook/inc/class.addressbook_groupdav.inc.php +++ b/addressbook/inc/class.addressbook_groupdav.inc.php @@ -1086,6 +1086,23 @@ class addressbook_groupdav extends Api\CalDAV\Handler return $shared; } + /** + * Hook to add properties to CardDAV root + * + * OS X 10.11.4 addressbook does a propfind for "addressbook-home-set" and "directory-gateway" + * in the root and does not continue without it. + * + * @param array $data + */ + public static function groupdav_root_props(array $data) + { + $data['props']['addressbook-home-set'] = Api\CalDAV::mkprop(Api\CalDAV::CARDDAV, 'addressbook-home-set', array( + Api\CalDAV::mkprop('href',$data['caldav']->base_uri.'/'.$GLOBALS['egw_info']['user']['account_lid'].'/'))); + + $data['props']['directory-gateway'] = Api\CalDAV::mkprop(Api\CalDAV::CARDDAV, 'directory-gateway', array( + Api\CalDAV::mkprop('href',$data['caldav']->base_uri.'/addressbook/'))); + } + /** * Return appliction specific settings * diff --git a/addressbook/setup/setup.inc.php b/addressbook/setup/setup.inc.php index 8387e73a90..bd677eb585 100755 --- a/addressbook/setup/setup.inc.php +++ b/addressbook/setup/setup.inc.php @@ -47,6 +47,7 @@ $setup_info['addressbook']['hooks']['not_enum_group_acls'] = 'addressbook_hooks: $setup_info['addressbook']['hooks']['export_limit'] = 'addressbook_hooks::getAppExportLimit'; $setup_info['addressbook']['hooks']['acl_rights'] = 'addressbook_hooks::acl_rights'; $setup_info['addressbook']['hooks']['categories'] = 'addressbook_hooks::categories'; +$setup_info['addressbook']['hooks']['groupdav_root_props'] = 'addressbook_groupdav::groupdav_root_props'; /* Dependencies for this app to work */ $setup_info['addressbook']['depends'][] = array(