mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-21 15:54:13 +00:00
Add CurrentUserPrivilegeSet to find carddav
This commit is contained in:
parent
7f8c17ad71
commit
266c39c655
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@
|
||||
|
||||
# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
|
||||
.glide/
|
||||
.idea/
|
||||
|
@ -524,6 +524,9 @@ func (b *backend) propFindAddressBook(ctx context.Context, propfind *internal.Pr
|
||||
return &maxResourceSize{Size: ab.MaxResourceSize}, nil
|
||||
}
|
||||
}
|
||||
props[internal.CurrentUserPrivilegeSetName] = func(*internal.RawXMLValue) (interface{}, error) {
|
||||
return &internal.CurrentUserPrivilegeSet{Privilege: internal.NewAllPrivileges()}, nil
|
||||
}
|
||||
|
||||
return internal.NewPropFindResponse(ab.Path, propfind, props)
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ var (
|
||||
GetETagName = xml.Name{Namespace, "getetag"}
|
||||
|
||||
CurrentUserPrincipalName = xml.Name{Namespace, "current-user-principal"}
|
||||
|
||||
CurrentUserPrivilegeSetName = xml.Name{Namespace, "current-user-privilege-set"}
|
||||
)
|
||||
|
||||
type Status struct {
|
||||
@ -417,6 +419,30 @@ type CurrentUserPrincipal struct {
|
||||
Unauthenticated *struct{} `xml:"unauthenticated,omitempty"`
|
||||
}
|
||||
|
||||
type CurrentUserPrivilegeSet struct {
|
||||
XMLName xml.Name `xml:"DAV: current-user-privilege-set"`
|
||||
Privilege []Privilege `xml:"privilege"`
|
||||
}
|
||||
|
||||
type Privilege struct {
|
||||
XMLName xml.Name `xml:"DAV: privilege"`
|
||||
Read *struct{} `xml:"DAV: read,omitempty"`
|
||||
All *struct{} `xml:"DAV: all,omitempty"`
|
||||
Write *struct{} `xml:"DAV: write,omitempty"`
|
||||
WriteProperties *struct{} `xml:"DAV: write-properties,omitempty"`
|
||||
WriteContent *struct{} `xml:"DAV: write-content,omitempty"`
|
||||
}
|
||||
|
||||
func NewAllPrivileges() []Privilege {
|
||||
return []Privilege{
|
||||
{Read: &struct{}{}},
|
||||
{All: &struct{}{}},
|
||||
{Write: &struct{}{}},
|
||||
{WriteProperties: &struct{}{}},
|
||||
{WriteContent: &struct{}{}},
|
||||
}
|
||||
}
|
||||
|
||||
// https://tools.ietf.org/html/rfc4918#section-14.19
|
||||
type PropertyUpdate struct {
|
||||
XMLName xml.Name `xml:"DAV: propertyupdate"`
|
||||
|
Loading…
Reference in New Issue
Block a user