further fix for "private contacts got not synced" issue, r31918 was not working, because filter[owner] was an array

This commit is contained in:
Ralf Becker 2010-09-08 09:47:57 +00:00
parent f4fa73412b
commit dc88857d9e

View File

@ -278,8 +278,18 @@ class addressbook_sql extends so_sql_cf
{ {
if (!($filter['owner'] = array_intersect((array)$filter['owner'],array_keys($this->grants)))) return false; if (!($filter['owner'] = array_intersect((array)$filter['owner'],array_keys($this->grants)))) return false;
// for an owner filter, which is NOT the current user, filter out private entries // for an owner filter, which does NOT include current user, filter out private entries
if ($filter['owner'] != $GLOBALS['egw_info']['user']['account_id']) $filter['private'] = 0; if (!in_array($GLOBALS['egw_info']['user']['account_id'],$filter['owner']))
{
$filter['private'] = 0;
}
// if multiple addressbooks (incl. current owner) are searched, we need full acl filter
elseif(count($filter['owner']) > 1)
{
$filter[] = "($this->table_name.contact_owner=".(int)$GLOBALS['egw_info']['user']['account_id'].
" OR contact_private=0 AND $this->table_name.contact_owner IN (".
implode(',',array_keys($this->grants)).") OR $this->table_name.contact_owner IS NULL)";
}
} }
else // search all addressbooks, incl. accounts else // search all addressbooks, incl. accounts
{ {