carddav: acl readonly (for Thunderbird)

This commit is contained in:
oliverpool
2024-10-10 20:36:03 +02:00
committed by Filip Góra
parent 9c900b1c66
commit 1d5a5dcd6c
5 changed files with 897 additions and 8 deletions

View File

@@ -496,13 +496,23 @@ func (b *backend) propFindAddressBook(ctx context.Context, propfind *internal.Pr
}
return &internal.CurrentUserPrincipal{Href: internal.Href{Path: path}}, nil
},
internal.ResourceTypeName: internal.PropFindValue(internal.NewResourceType(internal.CollectionName, addressBookName)),
supportedAddressDataName: internal.PropFindValue(&supportedAddressData{
Types: []addressDataType{
{ContentType: vcard.MIMEType, Version: "3.0"},
{ContentType: vcard.MIMEType, Version: "4.0"},
},
}),
internal.ResourceTypeName: func(*internal.RawXMLValue) (interface{}, error) {
return internal.NewResourceType(internal.CollectionName, addressBookName), nil
},
supportedAddressDataName: func(*internal.RawXMLValue) (interface{}, error) {
return &supportedAddressData{
Types: []addressDataType{
{ContentType: vcard.MIMEType, Version: "3.0"},
{ContentType: vcard.MIMEType, Version: "4.0"},
},
}, nil
},
internal.CurrentUserPrivilegeSetName: func(*internal.RawXMLValue) (interface{}, error) {
if ab.ReadOnly {
return &internal.CurrentUserPrivilegeSetReadOnly, nil
}
return &internal.CurrentUserPrivilegeSetReadWrite, nil
},
}
if ab.Name != "" {
@@ -569,6 +579,12 @@ func (b *backend) propFindAddressObject(ctx context.Context, propfind *internal.
return &addressDataResp{Data: buf.Bytes()}, nil
},
internal.CurrentUserPrivilegeSetName: func(*internal.RawXMLValue) (interface{}, error) {
if ao.ReadOnly {
return &internal.CurrentUserPrivilegeSetReadOnly, nil
}
return &internal.CurrentUserPrivilegeSetReadWrite, nil
},
}
if ao.ContentLength > 0 {