caldav: implement Propfind

It did not handle Depth or requests to calendar components. This brings
the implementation on par with the one CardDAV one.
This commit is contained in:
Conrad Hoffmann 2022-10-18 15:45:35 +02:00 committed by Simon Ser
parent 001e5953f7
commit 54f2a6355b

View File

@ -349,6 +349,8 @@ func (b *backend) PropFind(r *http.Request, propfind *internal.PropFind, depth i
return nil, err return nil, err
} }
var dataReq CalendarCompRequest
var resps []internal.Response var resps []internal.Response
if r.URL.Path == principalPath { if r.URL.Path == principalPath {
@ -370,10 +372,30 @@ func (b *backend) PropFind(r *http.Request, propfind *internal.PropFind, depth i
resps = append(resps, *resp) resps = append(resps, *resp)
if depth != internal.DepthZero { if depth != internal.DepthZero {
// TODO cos, err := b.Backend.ListCalendarObjects(r.Context(), &dataReq)
if err != nil {
return nil, err
}
for _, co := range cos {
resp, err := b.propFindCalendarObject(r.Context(), propfind, &co)
if err != nil {
return nil, err
}
resps = append(resps, *resp)
}
} }
} else { } else {
// TODO co, err := b.Backend.GetCalendarObject(r.Context(), r.URL.Path, &dataReq)
if err != nil {
return nil, err
}
resp, err := b.propFindCalendarObject(r.Context(), propfind, co)
if err != nil {
return nil, err
}
resps = append(resps, *resp)
} }
return internal.NewMultiStatus(resps...), nil return internal.NewMultiStatus(resps...), nil