From 47c861a89a03f00ff150bb3a73ca601098001333 Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 18 Nov 2024 19:26:50 +0100 Subject: [PATCH] fix contacts not found for regular (non-admin) users, if some users are hidden and search in all addressbooks (searching in a specific one worked) --- api/src/Contacts/Sql.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/src/Contacts/Sql.php b/api/src/Contacts/Sql.php index 82ec97e7d9..e5b1570279 100644 --- a/api/src/Contacts/Sql.php +++ b/api/src/Contacts/Sql.php @@ -720,7 +720,8 @@ class Sql extends Api\Storage if (!empty($filter['account_id']) && ($not_account_ids = array_search('!', $filter['account_id'])) !== false) { unset($filter['account_id'][$not_account_ids]); - $filter[] = $this->db->expression($this->table_name, ' NOT ', $this->table_name.'.', ['account_id' => $filter['account_id']]); + $filter[] = '('.$this->table_name.'.account_id IS NULL OR '. // "NULL NOT IN (1, 2)" is false in SQL, need to check it explicit + $this->db->expression($this->table_name, ' NOT ', $this->table_name.'.', ['account_id' => $filter['account_id']]).')'; unset($filter['account_id']); }