cyrusimap / cyrus-imapd

Cyrus IMAP is an email, contacts and calendar server
http://cyrusimap.org
Other
550 stars 151 forks source link

JMAP: session object always returns hasDataFor: [ mail ] shared accounts even if only addressbook or calendar shared #2368

Closed robmueller closed 6 years ago

robmueller commented 6 years ago

If a user Y shares only their address book with another user X, then when you fetch the JMAP session for use X, you get:

{
  "X": {
   ...
  },
  "Y": {
    "name": "Y",
    "isPrimary": false,
    "isReadOnly": false,
    "hasDataFor": ["mail"]
  }
}

The hasDataFor field should just be ["contacts"].

In general, you need to look at the types of all shared mailboxes and generate an appropriate hasDataFor set based on that (e.g. some combination of "mail", "contacts", "calendars" depending on which folder types have been shared).

rsto commented 6 years ago

That should be simple to do.

The way why this is done as-is: neither the JMAP calendar nor contacts spec define what to add in the hasDataFor property. So, it seemed OK to assume that just actual JMAP mail clients might care about what's in the hasDataFor property.

I'll add this this soon, but the spec for contacts and calendars might need to be updated as well.

robmueller commented 6 years ago

Yes right, this hasn't been standardised yet, however it's really useful to know what data types cyrus is making available via ACL sharing (so you know if you can do Mailbox/get, Contact/get and/or Calendar/get on a particular accountId), so having hasDataFor contain "mail", "contacts" and "calendars" as possible data types is certainly useful for clients.

These will hopefully eventually be standardised one day.

rsto commented 6 years ago

I've already pushed this to master with the entries being mail, contact and calendar (no plural). Fine with you?

robmueller commented 6 years ago

Talking with @neilj we think that maybe these should be the urn's, so:

That seems reasonable to me. Those last two are not official yet obviously, but they're neil's proposed ones.