From 6b17f2849051eab1cfc1b915d4b8def369debbc2 Mon Sep 17 00:00:00 2001 From: ralf Date: Thu, 27 Apr 2023 16:19:00 +0200 Subject: [PATCH] * Addressbook/CardDAV: show and allow to sync for default and forced preferences all ABs of the admin user also do NOT name the groups own AB "personal" --- addressbook/inc/class.addressbook_groupdav.inc.php | 13 +++++++++---- api/src/Contacts.php | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/addressbook/inc/class.addressbook_groupdav.inc.php b/addressbook/inc/class.addressbook_groupdav.inc.php index fb3502a53a..c545705bae 100644 --- a/addressbook/inc/class.addressbook_groupdav.inc.php +++ b/addressbook/inc/class.addressbook_groupdav.inc.php @@ -1323,12 +1323,17 @@ class addressbook_groupdav extends Api\CalDAV\Handler 'O' => lang('Sync all selected into one'), 'D' => lang('Distribution lists as groups') ); - if (!isset($hook_data['setup']) && in_array($hook_data['type'], array('user', 'group'))) + if (!isset($hook_data['setup'])) { - $user = $hook_data['account_id']; + $user = in_array($hook_data['type'], array('user', 'group')) ? $hook_data['account_id'] : + // for default or forced prefs show current users addressbooks + $GLOBALS['egw_info']['user']['account_id']; $addressbook_bo = new Api\Contacts(); $addressbooks += $addressbook_bo->get_addressbooks(Acl::READ, null, $user); - if ($user > 0) unset($addressbooks[$user]); // allways synced + if ($user > 0 || !in_array($hook_data['type'], array('user', 'group'))) + { + unset($addressbooks[$user]); // personal AB is always synced, and don't show if for default and forced prefs + } unset($addressbooks[$user.'p']);// ignore (optional) private addressbook for now } @@ -1338,7 +1343,7 @@ class addressbook_groupdav extends Api\CalDAV\Handler $addressbooks['N'] = lang('None'); } - // rewriting owner=0 to 'U', as 0 get's always selected by prefs + // rewriting owner=0 to 'U', as 0 gets always selected by prefs // not removing it for default or forced prefs based on current users pref if (!isset($addressbooks[0]) && (in_array($hook_data['type'], array('user', 'group')) || $GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts'] === '1')) diff --git a/api/src/Contacts.php b/api/src/Contacts.php index 7f3f2067b4..12e5ee1d7c 100755 --- a/api/src/Contacts.php +++ b/api/src/Contacts.php @@ -381,7 +381,10 @@ class Contacts extends Contacts\Storage $addressbooks = $to_sort = array(); if ($extra_label) $addressbooks[''] = $extra_label; - $addressbooks[$user] = lang('Personal'); + if ($user > 0) + { + $addressbooks[$user] = lang('Personal'); + } // add all group addressbooks the user has the necessary rights too foreach($grants as $uid => $rights) {