Change to read all calendars and then discard inaccessible ones

This commit is contained in:
Andrew McMillan 2013-10-15 23:43:35 +13:00
parent e6b502e71a
commit 58bbe1c8c3
3 changed files with 55 additions and 5 deletions

View File

@ -151,15 +151,17 @@ function get_collection_contents( $depth, $collection, $parent_path = null ) {
$sql = 'SELECT principal.*, collection.*, \'collection\' AS type ';
$sql .= 'FROM collection LEFT JOIN principal USING (user_no) ';
$sql .= 'WHERE parent_container = :this_dav_name ';
$sql .= "AND (path_privs(:session_principal::int8,collection.dav_name,:scan_depth::int) & 1::BIT(24))::INT4::BOOLEAN ";
$sql .= ' ORDER BY collection_id';
$params[':this_dav_name'] = $bound_from;
unset($params[':session_principal']);
unset($params[':scan_depth']);
}
$qry = new AwlQuery($sql, $params);
if( $qry->Exec('PROPFIND',__LINE__,__FILE__) && $qry->rows() > 0 ) {
while( $subcollection = $qry->Fetch() ) {
$resource = new DAVResource($subcollection);
if ( ! $resource->HavePrivilegeTo('DAV::read') ) continue;
$resource->set_bind_location( str_replace($bound_from,$bound_to,$subcollection->dav_name));
$responses[] = $resource->RenderAsXML($property_list, $reply);
if ( $depth > 0 ) {

View File

@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
ETag: "1f0e016ecbd8566bc60b88a167178059"
Content-Length: 1071
ETag: "01b056983b4d191d66f3286a33260b0c"
Content-Length: 1718
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
@ -20,6 +20,30 @@ Content-Type: text/xml; charset="utf-8"
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/resmgr1/home/</href>
<propstat>
<prop>
<group-membership>
<href>/caldav.php/resource1/calendar-proxy-write/</href>
<href>/caldav.php/resource2/calendar-proxy-write/</href>
</group-membership>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/resmgr1/addresses/</href>
<propstat>
<prop>
<group-membership>
<href>/caldav.php/resource1/calendar-proxy-write/</href>
<href>/caldav.php/resource2/calendar-proxy-write/</href>
</group-membership>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/resmgr1/calendar-proxy-read/</href>
<propstat>

View File

@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
ETag: "1f0e016ecbd8566bc60b88a167178059"
Content-Length: 1071
ETag: "01b056983b4d191d66f3286a33260b0c"
Content-Length: 1718
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
@ -20,6 +20,30 @@ Content-Type: text/xml; charset="utf-8"
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/resmgr1/home/</href>
<propstat>
<prop>
<group-membership>
<href>/caldav.php/resource1/calendar-proxy-write/</href>
<href>/caldav.php/resource2/calendar-proxy-write/</href>
</group-membership>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/resmgr1/addresses/</href>
<propstat>
<prop>
<group-membership>
<href>/caldav.php/resource1/calendar-proxy-write/</href>
<href>/caldav.php/resource2/calendar-proxy-write/</href>
</group-membership>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
</response>
<response>
<href>/caldav.php/resmgr1/calendar-proxy-read/</href>
<propstat>