mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 10:53:39 +01:00
Various GroupDAV improvements
This commit is contained in:
parent
26e2721fea
commit
9265095371
@ -391,9 +391,9 @@ class addressbook_groupdav extends groupdav_handler
|
||||
// should we hide the accounts addressbook
|
||||
if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) $filter['account_id'] = null;
|
||||
|
||||
$result = $this->bo->search(array(),'MAX(contact_modified) AS contact_modified','','','','','',$filter);
|
||||
$result = $this->bo->search(array(),'MAX(contact_modified) AS contact_modified','','','',false,'AND',false,$filter);
|
||||
|
||||
$ctag = 'EGw-'.$result[0]['modified'].'-wGE';
|
||||
$ctag = 'EGw-'.$result[0]['contact_modified'].'-wGE';
|
||||
return $ctag;
|
||||
}
|
||||
|
||||
|
@ -1350,13 +1350,41 @@ class HTTP_WebDAV_Server
|
||||
header("Content-length: ".$options['size']);
|
||||
}
|
||||
|
||||
$options["stream"] = fopen("php://input", "r");
|
||||
|
||||
if (method_exists($this, 'POST')) {
|
||||
$status = $this->POST($options);
|
||||
$status = $this->POST($options);
|
||||
|
||||
if ($status === false) {
|
||||
$status = '400 Something went wrong';
|
||||
} else if ($status === true) {
|
||||
$status = '200 OK';
|
||||
} else if (is_resource($status) && get_resource_type($status) == "stream") {
|
||||
$stream = $status;
|
||||
|
||||
$status = empty($options["new"]) ? '200 OK' : '201 Created';
|
||||
|
||||
if (!empty($options["ranges"])) {
|
||||
// TODO multipart support is missing (see also above)
|
||||
if (0 == fseek($stream, $range[0]["start"], SEEK_SET)) {
|
||||
$length = $range[0]["end"]-$range[0]["start"]+1;
|
||||
if (!fwrite($stream, fread($options["stream"], $length))) {
|
||||
$status = '403 Forbidden';
|
||||
}
|
||||
} else {
|
||||
$status = '403 Forbidden';
|
||||
}
|
||||
} else {
|
||||
while (!feof($options["stream"])) {
|
||||
if (false === fwrite($stream, fread($options["stream"], 4096))) {
|
||||
$status = '403 Forbidden';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($stream);
|
||||
}
|
||||
}
|
||||
|
||||
if ($status === true) $status = '200 OK';
|
||||
if ($status === false) $status = '400 Something went wrong';
|
||||
|
||||
$this->http_status($status);
|
||||
}
|
||||
|
||||
@ -2313,11 +2341,11 @@ class HTTP_WebDAV_Server
|
||||
));
|
||||
}
|
||||
//error_log( __METHOD__."\n" .print_r($url,true));
|
||||
return strtr($url, array(" "=>"%20",
|
||||
"&"=>"%26",
|
||||
"<"=>"%3C",
|
||||
">"=>"%3E",
|
||||
'+'=>'%2B',
|
||||
return strtr($url, array(' ' => '%20',
|
||||
'&' => '%26',
|
||||
'<' => '%3C',
|
||||
'>' => '%3E',
|
||||
'+' => '%2B',
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -273,12 +273,16 @@ class groupdav extends HTTP_WebDAV_Server
|
||||
self::mkprop('href',$this->base_uri.$user_prefix))),
|
||||
self::mkprop('current-user-principal',array(self::mkprop('href',$this->principalURL))),
|
||||
self::mkprop(groupdav::CALDAV,'calendar-user-address-set',array(
|
||||
self::mkprop('href','MAILTO:'.$GLOBALS['egw_info']['user']['email']))),
|
||||
self::mkprop('principal-collection-set',array(
|
||||
self::mkprop('href',$this->base_uri.'/principals/users/'),
|
||||
self::mkprop('href',$this->base_uri.'/principals/groups/'))),
|
||||
self::mkprop('href','MAILTO:'.$account['account_email']),
|
||||
self::mkprop('href',$this->base_uri.'/principals/users/'.$account['account_lid'].'/'),
|
||||
self::mkprop('href','urn:uuid:'.$account['account_lid']))),
|
||||
self::mkprop(groupdav::CALENDARSERVER,'email-address-set',array(
|
||||
self::mkprop(groupdav::CALENDARSERVER,'email-address',$GLOBALS['egw_info']['user']['email']))),
|
||||
//self::mkprop('principal-URL',array(self::mkprop('href',$this->principalURL))),
|
||||
//self::mkprop('principal-collection-set',array(self::mkprop('href',$this->base_uri.'/principals/'))),
|
||||
self::mkprop('principal-collection-set',array(self::mkprop('href',$this->base_uri.'/principals/'))),
|
||||
// OUTBOX URLs of the current user
|
||||
self::mkprop(groupdav::CALDAV,'schedule-outbox-URL',array(
|
||||
self::mkprop(groupdav::DAV,'href',$this->base_uri.'/calendar/'))),
|
||||
);
|
||||
//$props = self::current_user_privilege_set($props);
|
||||
$files['files'][] = array(
|
||||
@ -296,11 +300,11 @@ class groupdav extends HTTP_WebDAV_Server
|
||||
self::mkprop('displayname',lang('Accounts')),
|
||||
self::mkprop('resourcetype',array(self::mkprop('principals',''))),
|
||||
self::mkprop('current-user-principal',array(self::mkprop('href',$this->principalURL))),
|
||||
self::mkprop(groupdav::CALDAV,'calendar-home-set',array(
|
||||
self::mkprop('href',$this->base_uri.$user_prefix))),
|
||||
self::mkprop(groupdav::CARDDAV,'addressbook-home-set',array(
|
||||
self::mkprop('href',$this->base_uri.$user_prefix))),
|
||||
self::mkprop('principal-URL',array(self::mkprop('href',$this->principalURL))),
|
||||
//self::mkprop(groupdav::CALDAV,'calendar-home-set',array(
|
||||
// self::mkprop('href',$this->base_uri.$user_prefix))),
|
||||
//self::mkprop(groupdav::CARDDAV,'addressbook-home-set',array(
|
||||
// self::mkprop('href',$this->base_uri.$user_prefix))),
|
||||
//self::mkprop('principal-URL',array(self::mkprop('href',$this->principalURL))),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -382,9 +386,15 @@ class groupdav extends HTTP_WebDAV_Server
|
||||
self::mkprop('alternate-URI-set',array(
|
||||
self::mkprop('href','MAILTO:'.$GLOBALS['egw_info']['user']['email']))),
|
||||
self::mkprop('principal-collection-set',array(
|
||||
self::mkprop('href',$this->base_uri.'/principals/users/'),
|
||||
self::mkprop('href',$this->base_uri.'/principals/groups/'),
|
||||
self::mkprop('href',$this->base_uri.'/principals/'),
|
||||
)),
|
||||
self::mkprop('principal-URL',array(self::mkprop('href',$this->principalURL))),
|
||||
self::mkprop(groupdav::CALDAV,'calendar-user-address-set',array(
|
||||
self::mkprop('href','MAILTO:'.$GLOBALS['egw_info']['user']['email']),
|
||||
self::mkprop('href',$this->base_uri.'/principals/users/'.$GLOBALS['egw_info']['user']['account_lid'].'/'),
|
||||
self::mkprop('href','urn:uuid:'.$GLOBALS['egw_info']['user']['account_lid']))),
|
||||
self::mkprop(groupdav::CALENDARSERVER,'email-address-set',array(
|
||||
self::mkprop(groupdav::CALENDARSERVER,'email-address',$GLOBALS['egw_info']['user']['email']))),
|
||||
);
|
||||
|
||||
switch ($app)
|
||||
|
@ -84,6 +84,7 @@ class groupdav_principals extends groupdav_handler
|
||||
{
|
||||
$displayname = $this->translation->convert($account['account_fullname'],
|
||||
$this->translation->charset(),'utf-8');
|
||||
|
||||
$props = array(
|
||||
HTTP_WebDAV_Server::mkprop('displayname',$displayname),
|
||||
HTTP_WebDAV_Server::mkprop('getetag',$this->get_etag($account)),
|
||||
@ -91,9 +92,12 @@ class groupdav_principals extends groupdav_handler
|
||||
HTTP_WebDAV_Server::mkprop('principal', ''))),
|
||||
HTTP_WebDAV_Server::mkprop('alternate-URI-set',''),
|
||||
HTTP_WebDAV_Server::mkprop('principal-URL',$this->base_uri.'/principals/'.$account['account_lid']),
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-home-set',$this->base_uri.$account['account_lid'].'/'),
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-user-address-set','MAILTO:'.$account['account_email']),
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-home-set',array(
|
||||
HTTP_WebDAV_Server::mkprop('href',$this->base_uri.'/'.$account['account_lid'].'/'))),
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CARDDAV,'addressbook-home-set',array(
|
||||
HTTP_WebDAV_Server::mkprop('href',$this->base_uri.'/'.$account['account_lid'].'/'))),
|
||||
);
|
||||
|
||||
foreach($this->accounts->memberships($account['account_id']) as $gid => $group)
|
||||
{
|
||||
$props[] = HTTP_WebDAV_Server::mkprop('group-membership',$this->base_uri.'/groups/'.$group);
|
||||
@ -146,8 +150,11 @@ class groupdav_principals extends groupdav_handler
|
||||
{
|
||||
case '':
|
||||
$files[] = $this->add_account($account);
|
||||
$files[] = $this->add_collection('/principals/users/'.$account['account_lid'].'/calendar-proxy-read');
|
||||
$files[] = $this->add_collection('/principals/users/'.$account['account_lid'].'/calendar-proxy-write');
|
||||
if ($options['depth'])
|
||||
{
|
||||
$files[] = $this->add_collection('/principals/users/'.$account['account_lid'].'/calendar-proxy-read');
|
||||
$files[] = $this->add_collection('/principals/users/'.$account['account_lid'].'/calendar-proxy-write');
|
||||
}
|
||||
break;
|
||||
case 'calendar-proxy-read':
|
||||
case 'calendar-proxy-write':
|
||||
@ -250,10 +257,20 @@ class groupdav_principals extends groupdav_handler
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-home-set',array(
|
||||
HTTP_WebDAV_Server::mkprop('href',$this->base_uri.'/'.$account['account_lid'].'/'))),
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-user-address-set',array(
|
||||
HTTP_WebDAV_Server::mkprop('href','MAILTO:'.$account['account_email']))),
|
||||
HTTP_WebDAV_Server::mkprop('href','MAILTO:'.$account['account_email']),
|
||||
HTTP_WebDAV_Server::mkprop('href',$this->base_uri.'/principals/users/'.$account['account_lid'].'/'),
|
||||
HTTP_WebDAV_Server::mkprop('href','urn:uuid:'.$account['account_lid']))),
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'schedule-outbox-URL',array(
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::DAV,'href',$this->base_uri.'/calendar/'))),
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CALENDARSERVER,'email-address-set',array(
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CALENDARSERVER,'email-address',$account['account_email']))),
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CARDDAV,'addressbook-home-set',array(
|
||||
HTTP_WebDAV_Server::mkprop('href',$this->base_uri.'/'.$account['account_lid'].'/'))),
|
||||
HTTP_WebDAV_Server::mkprop('group-member-ship', $memberships),
|
||||
HTTP_WebDAV_Server::mkprop('supported-report-set',array(
|
||||
HTTP_WebDAV_Server::mkprop('supported-report',array(
|
||||
HTTP_WebDAV_Server::mkprop('report',
|
||||
HTTP_WebDAV_Server::mkprop('acl-principal-prop-set')))))),
|
||||
);
|
||||
if ($this->debug > 1) error_log(__METHOD__."($path) path=/principals/users/".$account['account_lid'].', props='.array2string($props));
|
||||
return array(
|
||||
@ -288,7 +305,7 @@ class groupdav_principals extends groupdav_handler
|
||||
HTTP_WebDAV_Server::mkprop('principal', ''))),
|
||||
HTTP_WebDAV_Server::mkprop('alternate-URI-set',''),
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CALDAV,'calendar-home-set',array(
|
||||
HTTP_WebDAV_Server::mkprop('href',$this->base_uri.'/'.$account['account_lid'].'/calendar/'))),
|
||||
HTTP_WebDAV_Server::mkprop('href',$this->base_uri.'/'.$account['account_lid'].'/'))),
|
||||
HTTP_WebDAV_Server::mkprop(groupdav::CARDDAV,'addressbook-home-set',array(
|
||||
HTTP_WebDAV_Server::mkprop('href',$this->base_uri.'/'.$account['account_lid'].'/'))),
|
||||
HTTP_WebDAV_Server::mkprop('group-member-set', $members),
|
||||
|
Loading…
Reference in New Issue
Block a user