correctly handle $filter[owner] to be an array with multiple owners/addressbooks

This commit is contained in:
Ralf Becker 2010-05-28 07:23:30 +00:00
parent 226908f7ab
commit d755693944

View File

@ -264,7 +264,7 @@ class addressbook_sql extends so_sql_cf
// we have no private grants in addressbook at the moment, they have then to be added here too
if (isset($filter['owner']))
{
if (!$this->grants[(int) $filter['owner']]) return false; // we have no access to that addressbook
if (!($filter['owner'] = array_intersect((array)$filter['owner'],array_keys($this->grants)))) return false;
$filter['private'] = 0;
}
@ -309,16 +309,6 @@ class addressbook_sql extends so_sql_cf
}
break;
}
if (isset($filter['owner']))
{
$filter[] = $this->table_name.'.contact_owner='.(int)$filter['owner'];
unset($filter['owner']);
}
if (is_array($criteria) && isset($criteria['owner']))
{
$criteria[] = $this->table_name.'.contact_owner='.(int)$criteria['owner'];
unset($criteria['owner']);
}
// postgres requires that expressions in order by appear in the columns of a distinct select
if ($this->db->Type != 'mysql' && preg_match("/([a-zA-Z_.]+)<>''/",$order_by,$matches))
{