* 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:14:20 +00:00
parent 48fd2113f3
commit ffefc2848e
2 changed files with 11 additions and 4 deletions

View File

@ -1001,9 +1001,10 @@ class addressbook_so
*/ */
function read_lists($keys,$member_attr=null,$limit_in_ab=false) 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);
} }
/** /**
@ -1017,9 +1018,10 @@ class addressbook_so
*/ */
function add_list($keys,$owner,$contacts=array(),array &$data=array()) 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

@ -485,6 +485,11 @@ class addressbook_sql extends so_sql_cf
*/ */
function get_lists($uids,$uid_column='list_owner',$member_attr=null,$limit_in_ab=false) function get_lists($uids,$uid_column='list_owner',$member_attr=null,$limit_in_ab=false)
{ {
if (is_array($uids) && array_key_exists('list_id', $uids))
{
$uids[] = $this->db->expression($this->lists_table, $this->lists_table.'.',array('list_id' => $uids['list_id']));
unset($uids['list_id']);
}
$lists = array(); $lists = array();
foreach($this->db->select($this->lists_table,'*',$uid_column?array($uid_column=>$uids):$uids,__LINE__,__FILE__, foreach($this->db->select($this->lists_table,'*',$uid_column?array($uid_column=>$uids):$uids,__LINE__,__FILE__,
false,'ORDER BY list_owner<>'.(int)$GLOBALS['egw_info']['user']['account_id'].',list_name') as $row) false,'ORDER BY list_owner<>'.(int)$GLOBALS['egw_info']['user']['account_id'].',list_name') as $row)