Skip to content

implements CurrentUserPrivilegeSet to add compatibility with thunderb…#170

Closed
mheers wants to merge 3 commits intoemersion:masterfrom
mheers:master
Closed

implements CurrentUserPrivilegeSet to add compatibility with thunderb…#170
mheers wants to merge 3 commits intoemersion:masterfrom
mheers:master

Conversation

@mheers
Copy link

@mheers mheers commented Sep 23, 2024

…ird address book

Copy link

@oliverpool oliverpool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just got the exact same issue myself and solved it before seeing your PR 🙈

Comment on lines 424 to 429
Privileges []Privilege `xml:"privilege"`
}
type Privilege struct {
Read bool `xml:"read"`
Write bool `xml:"write"`
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my case, I got it to work with Thunderbird locally with the following structure (didn't tried yours TBH):

Suggested change
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)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the second part of the suggestion hasn't been applied. (But I prefer the struct approach.)

@oliverpool
Copy link

Reference: https://stackoverflow.com/a/57124617/3207406

mheers and others added 2 commits October 5, 2024 07:55
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"`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a list, could we use a struct with fields for read/write?

@oliverpool
Copy link

FYI my PR is ready for review: #172 (supports user-defined ReadOnly)

@emersion
Copy link
Owner

Superseded by a16253a

@emersion emersion closed this Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants