From 720eb89adbcc8d2b25fcd4a0b6674bf87b26e749 Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Sun, 30 Apr 2023 19:38:10 +1200 Subject: [PATCH] Add tests for checking that CONFIDENTIAL resources include all recurrance information This is to tickle #291. The only test that is actually required is 2603-GET-resource-confidential, but I want to make sure all the options were correct. In this commit 2603-GET-resource-confidential is expected to fail. --- .../2600-PUT-collection.result | 32 ++++++ .../regression-suite/2600-PUT-collection.test | 107 ++++++++++++++++++ .../2601-POST-freebusy-confidential.result | 42 +++++++ .../2601-POST-freebusy-confidential.test | 57 ++++++++++ .../2602-GET-freebusy-confidential.result | 34 ++++++ .../2602-GET-freebusy-confidential.test | 31 +++++ .../2603-GET-resource-confidential.result | 53 +++++++++ .../2603-GET-resource-confidential.test | 13 +++ .../2604-REPORT-freebusy-confidential.result | 36 ++++++ .../2604-REPORT-freebusy-confidential.test | 41 +++++++ 10 files changed, 446 insertions(+) create mode 100644 testing/tests/regression-suite/2600-PUT-collection.result create mode 100644 testing/tests/regression-suite/2600-PUT-collection.test create mode 100644 testing/tests/regression-suite/2601-POST-freebusy-confidential.result create mode 100644 testing/tests/regression-suite/2601-POST-freebusy-confidential.test create mode 100644 testing/tests/regression-suite/2602-GET-freebusy-confidential.result create mode 100644 testing/tests/regression-suite/2602-GET-freebusy-confidential.test create mode 100644 testing/tests/regression-suite/2603-GET-resource-confidential.result create mode 100644 testing/tests/regression-suite/2603-GET-resource-confidential.test create mode 100644 testing/tests/regression-suite/2604-REPORT-freebusy-confidential.result create mode 100644 testing/tests/regression-suite/2604-REPORT-freebusy-confidential.test diff --git a/testing/tests/regression-suite/2600-PUT-collection.result b/testing/tests/regression-suite/2600-PUT-collection.result new file mode 100644 index 00000000..ab33bbfc --- /dev/null +++ b/testing/tests/regression-suite/2600-PUT-collection.result @@ -0,0 +1,32 @@ +HTTP/1.1 200 OK +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 +Content-Length: 0 +Content-Type: text/plain; charset="utf-8" + + + caldav_data: >2< + + calendar_item: >2< + + alarms: >0< + + attendees: >0< + + collection_id: >1616< + dav_displayname: >291-test-fb-rr-changes< + dav_etag: >c21098570619a44e7d30283d0a703a4b< + dav_name: >/user1/291-test-fb-rr-changes/< +default_privilege: >NULL< + description: >< + is_addressbook: >0< + is_calendar: >1< + parent_container: >/user1/< +public_events_onl: >0< +publicly_readable: >0< + resourcetypes: >< + schedule_transp: >opaque< + timezone: >NULL< + user_no: >10< + diff --git a/testing/tests/regression-suite/2600-PUT-collection.test b/testing/tests/regression-suite/2600-PUT-collection.test new file mode 100644 index 00000000..bed74ee2 --- /dev/null +++ b/testing/tests/regression-suite/2600-PUT-collection.test @@ -0,0 +1,107 @@ +# +# Put a recurring event with changes. +# +# There is no CalDAV defined behaviour for this. +# +TYPE=PUT +URL=http://regression.host/caldav.php/user1/291-test-fb-rr-changes/ +HEADER=User-Agent: RSCDS Testing/0.7.x +HEADER=Content-Type: text/calendar; charset=utf-8 +AUTH=admin:nimda + +HEAD + +BEGINDATA +BEGIN:VCALENDAR +CALSCALE:GREGORIAN +PRODID:-//Ximian//NONSGML Evolution Calendar//EN +VERSION:2.0 + +BEGIN:VTIMEZONE +TZID:Pacific/Auckland +X-LIC-LOCATION:Pacific/Auckland +BEGIN:DAYLIGHT +TZNAME:NZDT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +DTSTART:20070930T020000 +RRULE:FREQ=YEARLY;UNTIL=20360927T140000Z;BYDAY=-1SU;BYMONTH=9 +END:DAYLIGHT +BEGIN:STANDARD +TZNAME:NZST +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +DTSTART:20080406T030000 +RRULE:FREQ=YEARLY;UNTIL=20370404T140000Z;BYDAY=1SU;BYMONTH=4 +END:STANDARD +END:VTIMEZONE + +BEGIN:VEVENT +UID:409f61c7243c61c382a0795fd97249618e39543c +DTSTAMP:20230429T013749Z +DTSTART;TZID=Pacific/Auckland:20230419T110000 +DTEND;TZID=Pacific/Auckland:20230419T112500 +SEQUENCE:5 +SUMMARY:Daily Recurring +TRANSP:OPAQUE +CLASS:CONFIDENTIAL +CREATED:20230430T021510Z +LAST-MODIFIED:20230430T021534Z +END:VEVENT + +BEGIN:VEVENT +UID:d126ea19c4f19eed5dbac8d8a1578b022fa5cec9 +DTSTAMP:20230429T013749Z +DTSTART;TZID=Pacific/Auckland:20230417T090000 +DTEND;TZID=Pacific/Auckland:20230417T092500 +SEQUENCE:5 +SUMMARY:Daily Recurring +TRANSP:OPAQUE +CLASS:CONFIDENTIAL +CREATED:20230430T021510Z +LAST-MODIFIED:20230430T021929Z +RRULE;X-EVOLUTION-ENDDATE=20230420T210000Z:FREQ=DAILY;COUNT=5 +EXDATE:20230417T210000Z +EXDATE:20230418T210000Z +END:VEVENT + +END:VCALENDAR +ENDDATA + +QUERY +SELECT count(*) AS caldav_data FROM caldav_data WHERE dav_name ~ '^/user1/291-test-fb-rr-changes/' +ENDQUERY + +QUERY +SELECT count(*) AS calendar_item FROM calendar_item WHERE dav_name ~ '^/user1/291-test-fb-rr-changes/' +ENDQUERY + +QUERY +SELECT count(*) AS alarms FROM calendar_alarm JOIN calendar_item USING(dav_id) + WHERE dav_name ~ '^/user1/291-test-fb-rr-changes/' +ENDQUERY + +QUERY +SELECT count(*) AS attendees FROM calendar_attendee JOIN calendar_item USING(dav_id) + WHERE dav_name ~ '^/user1/291-test-fb-rr-changes/' +ENDQUERY + +QUERY +SELECT + collection_id, + dav_displayname, + dav_etag, + dav_name, +default_privileges, + description, + is_addressbook, + is_calendar, + parent_container, +public_events_only, + resourcetypes, + schedule_transp, + timezone, + user_no, + publicly_readable + FROM collection WHERE dav_name = '/user1/291-test-fb-rr-changes/' +ENDQUERY diff --git a/testing/tests/regression-suite/2601-POST-freebusy-confidential.result b/testing/tests/regression-suite/2601-POST-freebusy-confidential.result new file mode 100644 index 00000000..48ea0667 --- /dev/null +++ b/testing/tests/regression-suite/2601-POST-freebusy-confidential.result @@ -0,0 +1,42 @@ + + + + + mailto:user1@example.net + + 2.0;Success + BEGIN:VCALENDAR +PRODID:-//davical.org//NONSGML AWL Calendar//EN +VERSION:2.0 +CALSCALE:GREGORIAN +METHOD:REPLY +BEGIN:VFREEBUSY +DTSTAMP:yyyymmddThhmmssZ +DTSTART:20230416T000000Z +DTEND:20230421T000000Z +FREEBUSY:20230416T210000Z/20230416T212500Z +FREEBUSY:20230418T230000Z/20230418T232500Z +FREEBUSY:20230419T210000Z/20230419T212500Z +FREEBUSY:20230420T210000Z/20230420T212500Z +UID:c5bd82ea-cd89-4f58-8d31-336f47e44f98 +ORGANIZER:mailto:user4@example.net +ATTENDEE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;CUTYPE=INDIVIDUAL: + mailto:user1@example.net +END:VFREEBUSY +END:VCALENDAR + + + + + class: >CONFIDENTIAL< + dav_name: >/user1/291-test-fb-rr-changes/409f61c7243c61c382a0795fd97249618e39543c.ics< + finish: >20230418T232500Z< + rrule: >NULL< + start: >20230418T230000Z< + + class: >CONFIDENTIAL< + dav_name: >/user1/291-test-fb-rr-changes/d126ea19c4f19eed5dbac8d8a1578b022fa5cec9.ics< + finish: >20230416T212500Z< + rrule: >FREQ=DAILY;COUNT=5< + start: >20230416T210000Z< + diff --git a/testing/tests/regression-suite/2601-POST-freebusy-confidential.test b/testing/tests/regression-suite/2601-POST-freebusy-confidential.test new file mode 100644 index 00000000..cfa9a094 --- /dev/null +++ b/testing/tests/regression-suite/2601-POST-freebusy-confidential.test @@ -0,0 +1,57 @@ +# +# POST to scheduling outbox for freebusy query of user4 for user1 +# "Daily Recurring" event should generate 4x events, 3x at the same +# time, and 1x at a different time. +# +TYPE=POST +URL=http://regression.host/caldav.php/user4/.out/ +AUTH=user4:user4 + +HEADER=User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.18pre) Gecko/20100917 Sunbird/0.9 +HEADER=Accept: text/xml +HEADER=Accept-Language: en-us,en;q=0.5 +HEADER=Accept-Charset: utf-8,*;q=0.1 +HEADER=Content-Type: text/calendar; charset=utf-8 +HEADER=Originator: mailto:user4@example.net +HEADER=Recipient: mailto:user1@example.net + +# HEAD + +REPLACE=/^DTSTAMP:\d{4}[01]\d[0123]\dT[012]\d[0-5]\d[0-6]\dZ\r?$/DTSTAMP:yyyymmddThhmmssZ/ +# REPLACE=/^ETag: "[[:hexdigit:]]+"\s$/ETag: "a fine looking etag"/ + +BEGINDATA +BEGIN:VCALENDAR +PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN +VERSION:2.0 +METHOD:REQUEST +BEGIN:VFREEBUSY +DTSTAMP:20230430T062945Z +ORGANIZER:mailto:user4@example.net +DTSTART:20230416T000000Z +DTEND:20230421T000000Z +UID:c5bd82ea-cd89-4f58-8d31-336f47e44f98 +ATTENDEE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT;CUTYPE=INDIVIDUAL: + mailto:user1@example.net +END:VFREEBUSY +END:VCALENDAR +ENDDATA + +QUERY +SELECT calendar_item.rrule, + to_char(calendar_item.dtstart at time zone 'GMT','YYYYMMDD"T"HH24MISS"Z"') AS start, + to_char(calendar_item.dtend at time zone 'GMT','YYYYMMDD"T"HH24MISS"Z"') AS finish, + class, + calendar_item.dav_name + FROM usr INNER JOIN collection USING (user_no) + INNER JOIN caldav_data USING (collection_id) + INNER JOIN calendar_item USING(dav_id) +WHERE caldav_data.dav_name LIKE '/user1/291-test-fb-rr-changes/%' + AND collection.is_calendar + AND rrule_event_overlaps( dtstart, dtend, rrule, '20230417T000000Z', '20230421T000000Z' ) + AND caldav_data.caldav_type IN ( 'VEVENT', 'VFREEBUSY' ) + AND (calendar_item.transp != 'TRANSPARENT' OR calendar_item.transp IS NULL) + AND (calendar_item.status != 'CANCELLED' OR calendar_item.status IS NULL) + ORDER BY dav_id +ENDQUERY + diff --git a/testing/tests/regression-suite/2602-GET-freebusy-confidential.result b/testing/tests/regression-suite/2602-GET-freebusy-confidential.result new file mode 100644 index 00000000..eb7eb667 --- /dev/null +++ b/testing/tests/regression-suite/2602-GET-freebusy-confidential.result @@ -0,0 +1,34 @@ +HTTP/1.1 200 OK +Date: Dow, 01 Jan 2000 00:00:00 GMT +Content-Length: 398 +Content-Type: text/calendar;charset=UTF-8 + +BEGIN:VCALENDAR +PRODID:-//davical.org//NONSGML AWL Calendar//EN +VERSION:2.0 +CALSCALE:GREGORIAN +BEGIN:VFREEBUSY +DTSTAMP:yyyymmddThhmmssZ +DTSTART:20230415T000000Z +DTEND:20230425T000000Z +FREEBUSY:20230416T210000Z/20230416T212500Z +FREEBUSY:20230418T230000Z/20230418T232500Z +FREEBUSY:20230419T210000Z/20230419T212500Z +FREEBUSY:20230420T210000Z/20230420T212500Z +END:VFREEBUSY +END:VCALENDAR + + a) Start: >2023-04-17 09:00:00< + b) Location: >Pacific/Auckland< + c) UTC Start: >20230416T210000Z< + d) UTC End: >20230416T212500Z< + rrule: >FREQ=DAILY;COUNT=5< + status: >NULL< + + a) Start: >2023-04-19 11:00:00< + b) Location: >Pacific/Auckland< + c) UTC Start: >20230418T230000Z< + d) UTC End: >20230418T232500Z< + rrule: >NULL< + status: >NULL< + diff --git a/testing/tests/regression-suite/2602-GET-freebusy-confidential.test b/testing/tests/regression-suite/2602-GET-freebusy-confidential.test new file mode 100644 index 00000000..4ae4ef13 --- /dev/null +++ b/testing/tests/regression-suite/2602-GET-freebusy-confidential.test @@ -0,0 +1,31 @@ +# +# Request a freebusy report by URL +# +# +TYPE=GET +URL=http://regression.host/freebusy.php/user1/291-test-fb-rr-changes/?start=20230415T000000&period=P10D +HEAD + +AUTH=user4:user4 + +REPLACE=/^DTSTAMP:\d{8}T\d{6}Z\r?$/DTSTAMP:yyyymmddThhmmssZ/ +#REPLACE=/^DTSTART:20210918T000000Z\r?$/DTSTART:correct/ +#REPLACE=/^DTEND:20210921T000000Z\r?$/DTEND:correct/ + +QUERY +SELECT calendar_item.rrule, calendar_item.status, + dtstart AT TIME ZONE olson_name AS "a) Start", + olson_name AS "b) Location", + to_char(calendar_item.dtstart at time zone 'GMT','YYYYMMDD"T"HH24MISS"Z"') AS "c) UTC Start", + to_char(calendar_item.dtend at time zone 'GMT','YYYYMMDD"T"HH24MISS"Z"') AS "d) UTC End" + FROM usr INNER JOIN collection USING (user_no) + INNER JOIN caldav_data USING (collection_id) + INNER JOIN calendar_item USING(dav_id) + LEFT JOIN timezones ON (tz_id=tzid) +WHERE caldav_data.dav_name ~ '^/user1/291-test-fb-rr-changes/' + AND collection.is_calendar AND collection.schedule_transp = 'opaque' + AND caldav_data.caldav_type IN ( 'VEVENT', 'VFREEBUSY' ) + AND (calendar_item.transp != 'TRANSPARENT' OR calendar_item.transp IS NULL) + AND (calendar_item.status != 'CANCELLED' OR calendar_item.status IS NULL) + ORDER BY 3 +ENDQUERY diff --git a/testing/tests/regression-suite/2603-GET-resource-confidential.result b/testing/tests/regression-suite/2603-GET-resource-confidential.result new file mode 100644 index 00000000..4760f2e9 --- /dev/null +++ b/testing/tests/regression-suite/2603-GET-resource-confidential.result @@ -0,0 +1,53 @@ +HTTP/1.1 200 OK +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: "c21098570619a44e7d30283d0a703a4b" +Content-Length: 1161 +Content-Type: text/calendar; charset="utf-8" + +BEGIN:VCALENDAR +PRODID:-//davical.org//NONSGML AWL Calendar//EN +VERSION:2.0 +CALSCALE:GREGORIAN +X-WR-CALNAME:291-test-fb-rr-changes +BEGIN:VEVENT +SUMMARY:Busy +CLASS:CONFIDENTIAL +DTSTART;TZID=Pacific/Auckland:20230417T090000 +RRULE;X-EVOLUTION-ENDDATE=20230420T210000Z:FREQ=DAILY;COUNT=5 +EXDATE:20230417T210000Z +EXDATE:20230418T210000Z +SEQUENCE:5 +DTEND;TZID=Pacific/Auckland:20230417T092500 +UID:d126ea19c4f19eed5dbac8d8a1578b022fa5cec9 +CREATED:20230430T021510Z +END:VEVENT +BEGIN:VEVENT +SUMMARY:Busy +CLASS:CONFIDENTIAL +DTSTART;TZID=Pacific/Auckland:20230419T110000 +SEQUENCE:5 +DTEND;TZID=Pacific/Auckland:20230419T112500 +UID:409f61c7243c61c382a0795fd97249618e39543c +CREATED:20230430T021510Z +END:VEVENT +BEGIN:VTIMEZONE +TZID:Pacific/Auckland +X-LIC-LOCATION:Pacific/Auckland +BEGIN:DAYLIGHT +TZNAME:NZDT +TZOFFSETFROM:+1200 +TZOFFSETTO:+1300 +DTSTART:20070930T020000 +RRULE:FREQ=YEARLY;UNTIL=20360927T140000Z;BYDAY=-1SU;BYMONTH=9 +END:DAYLIGHT +BEGIN:STANDARD +TZNAME:NZST +TZOFFSETFROM:+1300 +TZOFFSETTO:+1200 +DTSTART:20080406T030000 +RRULE:FREQ=YEARLY;UNTIL=20370404T140000Z;BYDAY=1SU;BYMONTH=4 +END:STANDARD +END:VTIMEZONE +END:VCALENDAR diff --git a/testing/tests/regression-suite/2603-GET-resource-confidential.test b/testing/tests/regression-suite/2603-GET-resource-confidential.test new file mode 100644 index 00000000..9ef20232 --- /dev/null +++ b/testing/tests/regression-suite/2603-GET-resource-confidential.test @@ -0,0 +1,13 @@ +# +# GET attempt against a URL we don't have access to, should be confidential result. +# +TYPE=GET +URL=http://regression.host/caldav.php/user1/291-test-fb-rr-changes/ +HEAD + +AUTH=user4:user4 + +BEGINDATA +ENDDATA + + diff --git a/testing/tests/regression-suite/2604-REPORT-freebusy-confidential.result b/testing/tests/regression-suite/2604-REPORT-freebusy-confidential.result new file mode 100644 index 00000000..034d3864 --- /dev/null +++ b/testing/tests/regression-suite/2604-REPORT-freebusy-confidential.result @@ -0,0 +1,36 @@ +HTTP/1.1 200 OK +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 +Content-Length: 398 +Content-Type: text/calendar;charset=UTF-8 + +BEGIN:VCALENDAR +PRODID:-//davical.org//NONSGML AWL Calendar//EN +VERSION:2.0 +CALSCALE:GREGORIAN +BEGIN:VFREEBUSY +DTSTAMP:yyyymmddThhmmssZ +DTSTART:20230416T140000Z +DTEND:20230421T220000Z +FREEBUSY:20230416T210000Z/20230416T212500Z +FREEBUSY:20230418T230000Z/20230418T232500Z +FREEBUSY:20230419T210000Z/20230419T212500Z +FREEBUSY:20230420T210000Z/20230420T212500Z +END:VFREEBUSY +END:VCALENDAR + + a) Start: >2023-04-17 09:00:00< + b) Location: >Pacific/Auckland< + c)UTC Start: >20230416T210000Z< + d) UTC End: >20230416T212500Z< + rrule: >FREQ=DAILY;COUNT=5< + status: >NULL< + + a) Start: >2023-04-19 11:00:00< + b) Location: >Pacific/Auckland< + c)UTC Start: >20230418T230000Z< + d) UTC End: >20230418T232500Z< + rrule: >NULL< + status: >NULL< + diff --git a/testing/tests/regression-suite/2604-REPORT-freebusy-confidential.test b/testing/tests/regression-suite/2604-REPORT-freebusy-confidential.test new file mode 100644 index 00000000..48ea2858 --- /dev/null +++ b/testing/tests/regression-suite/2604-REPORT-freebusy-confidential.test @@ -0,0 +1,41 @@ +# +# Request a REPORT which should report only CONFIDENTIAL freebusy +# +TYPE=REPORT +URL=http://regression.host/caldav.php/user1/291-test-fb-rr-changes/ +HEADER=User-Agent: CALDAV compliance testing +HEADER=Accept: text/calendar +HEADER=Content-Type: text/xml +HEADER=Depth: 1 +HEAD + +AUTH=user4:user4 + +BEGINDATA + + + + +ENDDATA + +REPLACE=/^DTSTAMP:\d{8}T\d{6}Z\r?$/DTSTAMP:yyyymmddThhmmssZ/ + +QUERY +SELECT calendar_item.rrule, calendar_item.status, + dtstart AT TIME ZONE olson_name AS "a) Start", + olson_name AS "b) Location", + to_char(calendar_item.dtstart at time zone 'GMT','YYYYMMDD"T"HH24MISS"Z"') AS "c)UTC Start", + to_char(calendar_item.dtend at time zone 'GMT','YYYYMMDD"T"HH24MISS"Z"') AS "d) UTC End" + FROM usr INNER JOIN collection USING (user_no) + INNER JOIN caldav_data USING (collection_id) + INNER JOIN calendar_item USING(dav_id) + LEFT JOIN timezones ON (tz_id=tzid) +WHERE caldav_data.dav_name ~ '^/user1/291-test-fb-rr-changes/' + AND collection.is_calendar AND collection.schedule_transp = 'opaque' + AND rrule_event_overlaps( dtstart, dtend, rrule, '20230416T000000Z', '20230421T000000Z' ) + AND caldav_data.caldav_type IN ( 'VEVENT', 'VFREEBUSY' ) + AND (calendar_item.transp != 'TRANSPARENT' OR calendar_item.transp IS NULL) + AND (calendar_item.status != 'CANCELLED' OR calendar_item.status IS NULL) + ORDER BY 3 +ENDQUERY