webdav: use internal.PropFindValue in servePrincipalPropfind

This commit is contained in:
Simon Ser 2025-10-18 10:55:23 +02:00
parent a16253aa97
commit f93b8288cc

View File

@ -365,21 +365,16 @@ func servePrincipalPropfind(w http.ResponseWriter, r *http.Request, options *Ser
return err return err
} }
props := map[xml.Name]internal.PropFindFunc{ props := map[xml.Name]internal.PropFindFunc{
internal.ResourceTypeName: func(*internal.RawXMLValue) (interface{}, error) { internal.ResourceTypeName: internal.PropFindValue(internal.NewResourceType(internal.PrincipalName)),
return internal.NewResourceType(internal.PrincipalName), nil internal.CurrentUserPrincipalName: internal.PropFindValue(&internal.CurrentUserPrincipal{
}, Href: internal.Href{Path: options.CurrentUserPrincipalPath},
internal.CurrentUserPrincipalName: func(*internal.RawXMLValue) (interface{}, error) { }),
return &internal.CurrentUserPrincipal{Href: internal.Href{Path: options.CurrentUserPrincipalPath}}, nil
},
} }
// TODO: handle Depth and more properties // TODO: handle Depth and more properties
for _, homeSet := range options.HomeSets { for _, homeSet := range options.HomeSets {
hs := homeSet // capture variable for closure props[homeSet.GetXMLName()] = internal.PropFindValue(homeSet)
props[homeSet.GetXMLName()] = func(*internal.RawXMLValue) (interface{}, error) {
return hs, nil
}
} }
resp, err := internal.NewPropFindResponse(r.URL.Path, &propfind, props) resp, err := internal.NewPropFindResponse(r.URL.Path, &propfind, props)