* CardDAV/Addressbook/ActiveDirectory: fixes SQL error when clients tries to propfind groups/distribution lists on accounts-addressbook, also return "403 Forbidden" when he tries to create one, as they are not (yet) supported on accounts, if not stored in SQL

This commit is contained in:
Ralf Becker 2013-08-06 09:15:22 +00:00
parent c61ccc9372
commit f4597f6314
2 changed files with 12 additions and 5 deletions

View File

@ -977,9 +977,10 @@ class addressbook_so
*/
function read_lists($keys,$member_attr=null,$limit_in_ab=false)
{
if (!method_exists($this->somain,'get_lists')) return false;
$backend = (string)$limit_in_ab === '0' && $this->so_accounts ? $this->so_accounts : $this->somain;
if (!method_exists($backend, 'get_lists')) return false;
return $this->somain->get_lists($keys,null,$member_attr,$limit_in_ab);
return $backend->get_lists($keys,null,$member_attr,$limit_in_ab);
}
/**
@ -993,9 +994,10 @@ class addressbook_so
*/
function add_list($keys,$owner,$contacts=array(),array &$data=array())
{
if (!method_exists($this->somain,'add_list')) return false;
$backend = (string)$owner === '0' && $this->so_accounts ? $this->so_accounts : $this->somain;
if (!method_exists($backend, 'add_list')) return false;
return $this->somain->add_list($keys,$owner,$contacts,$data);
return $backend->add_list($keys,$owner,$contacts,$data);
}
/**

View File

@ -468,7 +468,7 @@ class addressbook_sql extends so_sql_cf
*/
function get_lists($uids,$uid_column='list_owner',$member_attr=null,$limit_in_ab=false)
{
if (is_array($uids) && isset($uids['list_carddav_name']))
if (is_array($uids) && (array_key_exists('list_carddav_name', $uids) || array_key_exists('list_id', $uids)))
{
$ids = array();
foreach((array)$uids['list_carddav_name'] as $carddav_name)
@ -479,6 +479,11 @@ class addressbook_sql extends so_sql_cf
}
}
unset($uids['list_carddav_name']);
foreach((array)$uids['list_id'] as $id)
{
if (is_numeric($id) && $id > 0) $ids[] = $id;
}
unset($uids['list_id']);
if (!$ids) return array();
$uids[] = $this->db->expression($this->lists_table, $this->lists_table.'.',array('list_id' => $ids));
}