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:49:51 +00:00
parent 7a93bb1122
commit 719a283ede

View File

@ -269,8 +269,18 @@ class addressbook_sql extends so_sql
{
if (!$this->grants[(int) $filter['owner']]) return false; // we have no access to that addressbook
// for an owner filter, which is NOT the current user, filter out private entries
if ($filter['owner'] != $GLOBALS['egw_info']['user']['account_id']) $filter['private'] = 0;
// for an owner filter, which does NOT include current user, filter out private entries
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
{