Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions carddav/carddav.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type AddressBook struct {
Description string
MaxResourceSize int64
SupportedAddressData []AddressDataType
ReadOnly bool
}

func (ab *AddressBook) SupportsAddressData(contentType, version string) bool {
Expand Down Expand Up @@ -107,6 +108,7 @@ type AddressObject struct {
ContentLength int64
ETag string
Card vcard.Card
ReadOnly bool
}

// SyncQuery is the query struct represents a sync-collection request
Expand Down
12 changes: 12 additions & 0 deletions carddav/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,12 @@ func (b *backend) propFindAddressBook(ctx context.Context, propfind *internal.Pr
},
}, nil
},
internal.CurrentUserPrivilegeSetName: func(*internal.RawXMLValue) (interface{}, error) {
if ab.ReadOnly {
return &internal.CurrentUserPrivilegeSetReadOnly, nil
}
return &internal.CurrentUserPrivilegeSetReadWrite, nil
},
}

if ab.Name != "" {
Expand Down Expand Up @@ -573,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 {
Expand Down
Loading