caldav, carddav: add principal to resourcetype

This commit is contained in:
prasad83 2025-10-18 10:48:16 +02:00 committed by Simon Ser
parent 80149e46a4
commit 0e74e6df11
5 changed files with 6 additions and 6 deletions

View File

@ -490,7 +490,7 @@ func (b *backend) propFindUserPrincipal(ctx context.Context, propfind *internal.
calendarHomeSetName: internal.PropFindValue(&calendarHomeSet{
Href: internal.Href{Path: homeSetPath},
}),
internal.ResourceTypeName: internal.PropFindValue(internal.NewResourceType(internal.CollectionName)),
internal.ResourceTypeName: internal.PropFindValue(internal.NewResourceType(internal.CollectionName, internal.PrincipalName)),
}
return internal.NewPropFindResponse(principalPath, propfind, props)
}

View File

@ -456,7 +456,7 @@ func (b *backend) propFindUserPrincipal(ctx context.Context, propfind *internal.
}
return &addressbookHomeSet{Href: internal.Href{Path: homeSetPath}}, nil
},
internal.ResourceTypeName: internal.PropFindValue(internal.NewResourceType(internal.CollectionName)),
internal.ResourceTypeName: internal.PropFindValue(internal.NewResourceType(internal.CollectionName, internal.PrincipalName)),
}
return internal.NewPropFindResponse(principalPath, propfind, props)
}

View File

@ -7,7 +7,6 @@ import (
)
var (
principalName = xml.Name{"DAV:", "principal"}
principalAlternateURISetName = xml.Name{"DAV:", "alternate-URI-set"}
principalURLName = xml.Name{"DAV:", "principal-URL"}
groupMembershipName = xml.Name{"DAV:", "group-membership"}

View File

@ -21,6 +21,9 @@ var (
GetLastModifiedName = xml.Name{Namespace, "getlastmodified"}
GetETagName = xml.Name{Namespace, "getetag"}
CollectionName = xml.Name{Namespace, "collection"}
PrincipalName = xml.Name{Namespace, "principal"}
CurrentUserPrincipalName = xml.Name{Namespace, "current-user-principal"}
)
@ -332,8 +335,6 @@ func (t *ResourceType) Is(name xml.Name) bool {
return false
}
var CollectionName = xml.Name{Namespace, "collection"}
// https://tools.ietf.org/html/rfc4918#section-15.4
type GetContentLength struct {
XMLName xml.Name `xml:"DAV: getcontentlength"`

View File

@ -366,7 +366,7 @@ func servePrincipalPropfind(w http.ResponseWriter, r *http.Request, options *Ser
}
props := map[xml.Name]internal.PropFindFunc{
internal.ResourceTypeName: func(*internal.RawXMLValue) (interface{}, error) {
return internal.NewResourceType(principalName), nil
return internal.NewResourceType(internal.PrincipalName), nil
},
internal.CurrentUserPrincipalName: func(*internal.RawXMLValue) (interface{}, error) {
return &internal.CurrentUserPrincipal{Href: internal.Href{Path: options.CurrentUserPrincipalPath}}, nil