caldav, carddav: add current-user-privilege-set

This commit is contained in:
prasad83 2025-10-18 10:48:59 +02:00 committed by Simon Ser
parent 0e74e6df11
commit a16253aa97
3 changed files with 29 additions and 1 deletions

View File

@ -546,6 +546,13 @@ func (b *backend) propFindCalendar(ctx context.Context, propfind *internal.PropF
Comp: components, Comp: components,
}, nil }, nil
}, },
// TODO: Gather UserPrivilege from backend to control read-and-write
internal.CurrentUserPrivilegeSetName: internal.PropFindValue(&internal.CurrentUserPrivilegeSet{
Privilege: []internal.Privilege{{
Read: &struct{}{},
Write: &struct{}{},
}},
}),
} }
if cal.Name != "" { if cal.Name != "" {

View File

@ -497,6 +497,13 @@ func (b *backend) propFindAddressBook(ctx context.Context, propfind *internal.Pr
{ContentType: vcard.MIMEType, Version: "4.0"}, {ContentType: vcard.MIMEType, Version: "4.0"},
}, },
}), }),
// TODO: Gather UserPrivilege from backend to control read-and-write
internal.CurrentUserPrivilegeSetName: internal.PropFindValue(&internal.CurrentUserPrivilegeSet{
Privilege: []internal.Privilege{{
Read: &struct{}{},
Write: &struct{}{},
}},
}),
} }
if ab.Name != "" { if ab.Name != "" {

View File

@ -25,6 +25,7 @@ var (
PrincipalName = xml.Name{Namespace, "principal"} PrincipalName = xml.Name{Namespace, "principal"}
CurrentUserPrincipalName = xml.Name{Namespace, "current-user-principal"} CurrentUserPrincipalName = xml.Name{Namespace, "current-user-principal"}
CurrentUserPrivilegeSetName = xml.Name{Namespace, "current-user-privilege-set"}
) )
type Status struct { type Status struct {
@ -451,3 +452,16 @@ type Limit struct {
XMLName xml.Name `xml:"DAV: limit"` XMLName xml.Name `xml:"DAV: limit"`
NResults uint `xml:"nresults"` NResults uint `xml:"nresults"`
} }
// https://tools.ietf.org/html/rfc3744#section-5.4
type CurrentUserPrivilegeSet struct {
XMLName xml.Name `xml:"DAV: current-user-privilege-set"`
Privilege []Privilege
}
// https://tools.ietf.org/html/rfc3744#section-5.4
type Privilege struct {
XMLName xml.Name `xml:"DAV: privilege"`
Read *struct{} `xml:"DAV: read,omitempty"`
Write *struct{} `xml:"DAV: write,omitempty"`
}