From 58bbe1c8c30620b231cb080f1cc84e497d0791f9 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Tue, 15 Oct 2013 23:43:35 +1300 Subject: [PATCH] Change to read all calendars and then discard inaccessible ones --- inc/caldav-PROPFIND.php | 4 ++- .../0527-iCal-PROPFIND.result | 28 +++++++++++++++++-- .../0528-iCal-PROPFIND.result | 28 +++++++++++++++++-- 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/inc/caldav-PROPFIND.php b/inc/caldav-PROPFIND.php index 0b2d955d..7904dd53 100644 --- a/inc/caldav-PROPFIND.php +++ b/inc/caldav-PROPFIND.php @@ -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 ) { diff --git a/testing/tests/regression-suite/0527-iCal-PROPFIND.result b/testing/tests/regression-suite/0527-iCal-PROPFIND.result index b1389e60..eb1e4d9f 100644 --- a/testing/tests/regression-suite/0527-iCal-PROPFIND.result +++ b/testing/tests/regression-suite/0527-iCal-PROPFIND.result @@ -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" @@ -20,6 +20,30 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK + + /caldav.php/resmgr1/home/ + + + + /caldav.php/resource1/calendar-proxy-write/ + /caldav.php/resource2/calendar-proxy-write/ + + + HTTP/1.1 200 OK + + + + /caldav.php/resmgr1/addresses/ + + + + /caldav.php/resource1/calendar-proxy-write/ + /caldav.php/resource2/calendar-proxy-write/ + + + HTTP/1.1 200 OK + + /caldav.php/resmgr1/calendar-proxy-read/ diff --git a/testing/tests/regression-suite/0528-iCal-PROPFIND.result b/testing/tests/regression-suite/0528-iCal-PROPFIND.result index b1389e60..eb1e4d9f 100644 --- a/testing/tests/regression-suite/0528-iCal-PROPFIND.result +++ b/testing/tests/regression-suite/0528-iCal-PROPFIND.result @@ -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" @@ -20,6 +20,30 @@ Content-Type: text/xml; charset="utf-8" HTTP/1.1 200 OK + + /caldav.php/resmgr1/home/ + + + + /caldav.php/resource1/calendar-proxy-write/ + /caldav.php/resource2/calendar-proxy-write/ + + + HTTP/1.1 200 OK + + + + /caldav.php/resmgr1/addresses/ + + + + /caldav.php/resource1/calendar-proxy-write/ + /caldav.php/resource2/calendar-proxy-write/ + + + HTTP/1.1 200 OK + + /caldav.php/resmgr1/calendar-proxy-read/