caldav, carddav: add principal to resourcetype
This commit is contained in:
parent
80149e46a4
commit
0e74e6df11
@ -490,7 +490,7 @@ func (b *backend) propFindUserPrincipal(ctx context.Context, propfind *internal.
|
|||||||
calendarHomeSetName: internal.PropFindValue(&calendarHomeSet{
|
calendarHomeSetName: internal.PropFindValue(&calendarHomeSet{
|
||||||
Href: internal.Href{Path: homeSetPath},
|
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)
|
return internal.NewPropFindResponse(principalPath, propfind, props)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -456,7 +456,7 @@ func (b *backend) propFindUserPrincipal(ctx context.Context, propfind *internal.
|
|||||||
}
|
}
|
||||||
return &addressbookHomeSet{Href: internal.Href{Path: homeSetPath}}, nil
|
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)
|
return internal.NewPropFindResponse(principalPath, propfind, props)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
principalName = xml.Name{"DAV:", "principal"}
|
|
||||||
principalAlternateURISetName = xml.Name{"DAV:", "alternate-URI-set"}
|
principalAlternateURISetName = xml.Name{"DAV:", "alternate-URI-set"}
|
||||||
principalURLName = xml.Name{"DAV:", "principal-URL"}
|
principalURLName = xml.Name{"DAV:", "principal-URL"}
|
||||||
groupMembershipName = xml.Name{"DAV:", "group-membership"}
|
groupMembershipName = xml.Name{"DAV:", "group-membership"}
|
||||||
|
|||||||
@ -21,6 +21,9 @@ var (
|
|||||||
GetLastModifiedName = xml.Name{Namespace, "getlastmodified"}
|
GetLastModifiedName = xml.Name{Namespace, "getlastmodified"}
|
||||||
GetETagName = xml.Name{Namespace, "getetag"}
|
GetETagName = xml.Name{Namespace, "getetag"}
|
||||||
|
|
||||||
|
CollectionName = xml.Name{Namespace, "collection"}
|
||||||
|
PrincipalName = xml.Name{Namespace, "principal"}
|
||||||
|
|
||||||
CurrentUserPrincipalName = xml.Name{Namespace, "current-user-principal"}
|
CurrentUserPrincipalName = xml.Name{Namespace, "current-user-principal"}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -332,8 +335,6 @@ func (t *ResourceType) Is(name xml.Name) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
var CollectionName = xml.Name{Namespace, "collection"}
|
|
||||||
|
|
||||||
// https://tools.ietf.org/html/rfc4918#section-15.4
|
// https://tools.ietf.org/html/rfc4918#section-15.4
|
||||||
type GetContentLength struct {
|
type GetContentLength struct {
|
||||||
XMLName xml.Name `xml:"DAV: getcontentlength"`
|
XMLName xml.Name `xml:"DAV: getcontentlength"`
|
||||||
|
|||||||
@ -366,7 +366,7 @@ func servePrincipalPropfind(w http.ResponseWriter, r *http.Request, options *Ser
|
|||||||
}
|
}
|
||||||
props := map[xml.Name]internal.PropFindFunc{
|
props := map[xml.Name]internal.PropFindFunc{
|
||||||
internal.ResourceTypeName: func(*internal.RawXMLValue) (interface{}, error) {
|
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) {
|
internal.CurrentUserPrincipalName: func(*internal.RawXMLValue) (interface{}, error) {
|
||||||
return &internal.CurrentUserPrincipal{Href: internal.Href{Path: options.CurrentUserPrincipalPath}}, nil
|
return &internal.CurrentUserPrincipal{Href: internal.Href{Path: options.CurrentUserPrincipalPath}}, nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user