diff --git a/backend/app/dav/caldav.py b/backend/app/dav/caldav.py index c6dcc78..824f52b 100644 --- a/backend/app/dav/caldav.py +++ b/backend/app/dav/caldav.py @@ -269,13 +269,24 @@ def propfind(subpath=''): multistatus.append(_principal_response(user)) return _xml_response(multistatus) - # /dav// : principal only (no child collections in this listing - # so clients don't mix calendars and addressbooks). Clients follow - # calendar-home-set / addressbook-home-set for the actual lists. + # /dav// : principal itself + the two sub-containers as + # collection children (calendars/ and addressbooks/). The actual + # calendar/addressbook lists live under those home-sets. if len(parts) == 1: if parts[0] != user.username: return Response('', 403) multistatus.append(_principal_response(user)) + if depth != '0': + for (sub, dn) in (('calendars', 'Kalender'), ('addressbooks', 'Adressbücher')): + container = ET.Element(_qn('d', 'response')) + ET.SubElement(container, _qn('d', 'href')).text = f'/dav/{user.username}/{sub}/' + propstat = ET.SubElement(container, _qn('d', 'propstat')) + prop = ET.SubElement(propstat, _qn('d', 'prop')) + rt = ET.SubElement(prop, _qn('d', 'resourcetype')) + ET.SubElement(rt, _qn('d', 'collection')) + ET.SubElement(prop, _qn('d', 'displayname')).text = dn + ET.SubElement(propstat, _qn('d', 'status')).text = 'HTTP/1.1 200 OK' + multistatus.append(container) return _xml_response(multistatus) # /dav//calendars/ : only calendar collections