From acf9b33afb519a3f12e07a9b432cb15c7cbb28dc Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 4 Nov 2020 14:37:29 +0100 Subject: [PATCH] * Addressbook: allow sharing of individual contacts to make them available to other addressbooks or users add contact info to check_shared_with call, so sharerequires policy uses current data --- addressbook/inc/class.addressbook_ui.inc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 60a5b54354..37d9d47cfe 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -2219,7 +2219,7 @@ class addressbook_ui extends addressbook_bo foreach($content['shared'] as $key => $shared) { $shared_value = $shared['shared_id'].':'.$shared['shared_with'].':'.$shared['shared_by'].':'.$shared['shared_writable']; - if (($k = array_search($shared_value, $content['shared_values'])) === false) + if (($k = array_search($shared_value, (array)$content['shared_values'])) === false) { unset($content['shared'][$key]); } @@ -2228,9 +2228,11 @@ class addressbook_ui extends addressbook_bo unset($content['shared_values'][$k]); } } - foreach($content['shared_values'] as $account_id) + foreach((array)$content['shared_values'] as $account_id) { $content['shared'][] = [ + 'contact_id' => $content['id'], + 'contact' => $content, 'shared_with' => $account_id, 'shared_by' => $this->user, 'shared_at' => new Api\DateTime(),