implements CurrentUserPrivilegeSet to add compatibility with thunderb…#170
implements CurrentUserPrivilegeSet to add compatibility with thunderb…#170mheers wants to merge 3 commits intoemersion:masterfrom
Conversation
oliverpool
left a comment
There was a problem hiding this comment.
I just got the exact same issue myself and solved it before seeing your PR 🙈
internal/elements.go
Outdated
| Privileges []Privilege `xml:"privilege"` | ||
| } | ||
| type Privilege struct { | ||
| Read bool `xml:"read"` | ||
| Write bool `xml:"write"` | ||
| } |
There was a problem hiding this comment.
In my case, I got it to work with Thunderbird locally with the following structure (didn't tried yours TBH):
| Privileges []Privilege `xml:"privilege"` | |
| } | |
| type Privilege struct { | |
| Read bool `xml:"read"` | |
| Write bool `xml:"write"` | |
| } | |
| Privileges []Privilege `xml:"privilege>dynamic"` | |
| } | |
| type Privilege struct { | |
| XMLName xml.Name | |
| } |
And then return read, write like this:
return &internal.CurrentUserPrivilegeSet{Privileges: []internal.Privilege{{XMLName: xml.Name{"", "read"}}, {XMLName: xml.Name{"", "write"}}}}, nil(ideally the read/write privileges information should come from the backend)
There was a problem hiding this comment.
Seems like the second part of the suggestion hasn't been applied. (But I prefer the struct approach.)
|
Reference: https://stackoverflow.com/a/57124617/3207406 |
Co-authored-by: oliverpool <3864879+oliverpool@users.noreply.github.com>
Co-authored-by: oliverpool <3864879+oliverpool@users.noreply.github.com>
| // https://datatracker.ietf.org/doc/html/rfc3744#section-5.4 | ||
| type CurrentUserPrivilegeSet struct { | ||
| XMLName xml.Name `xml:"DAV: current-user-privilege-set"` | ||
| Privileges []Privilege `xml:"privilege>dynamic"` |
There was a problem hiding this comment.
Nit: this file use the same name as the XML element even if there may be multiple.
| // https://datatracker.ietf.org/doc/html/rfc3744#section-5.4 | ||
| type CurrentUserPrivilegeSet struct { | ||
| XMLName xml.Name `xml:"DAV: current-user-privilege-set"` | ||
| Privileges []Privilege `xml:"privilege>dynamic"` |
There was a problem hiding this comment.
Why dynamic? This doesn't appear in the RFC AFAIK.
| XMLName xml.Name `xml:"DAV: current-user-privilege-set"` | ||
| Privileges []Privilege `xml:"privilege>dynamic"` | ||
| } | ||
| type Privilege struct { |
There was a problem hiding this comment.
Instead of a list, could we use a struct with fields for read/write?
|
FYI my PR is ready for review: #172 (supports user-defined |
|
Superseded by a16253a |
…ird address book