[
https://issues.apache.org/jira/browse/JAMES-3357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17178865#comment-17178865
]
Benoit Tellier commented on JAMES-3357:
---------------------------------------
One should also be able to set rights via create requests.
This is an implementation of the rights on the creation part of Mailbox/set.
the rights are an extension proper to us, not part of the JMAP specs.
The rights allow to delegate permissions on a mailbox to other users.
**Request**
You will need to add a field in the mailbox/set request:
* **rights**: `Username[char]` Map of a user (defined by its `Username`) with
an array of `char`s (representing rights of that user on the mailbox)
```json
{
"using": [ "urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail" ],
"methodCalls": [
[
"Mailbox/set",
{
"accountId": "JMAP-ID",
"ifInState": null,
"create": {
"TEMP-MAILBOX-ID": {
"name": "mailbox_name",
"role": "Inbox",
"namespace": "Personal",
"rights": {
"bob": ["r", "e", "w"]
}
}
}
}
]
]
}
```
**DoD**: Unit and integration tests (memory and distributed james) making sure
that the rights are correctly set when creating a mailbox
> Mailbox/set creation: simple implementation
> -------------------------------------------
>
> Key: JAMES-3357
> URL: https://issues.apache.org/jira/browse/JAMES-3357
> Project: James Server
> Issue Type: New Feature
> Reporter: René Cordier
> Priority: Major
> Fix For: 3.6.0
>
>
> This is a first simple implementation of the creation part of Mailbox/set. It
> should follow the JMAP core specification section /set
> https://jmap.io/spec-core.html#set
> *Request*
> {code:json}
> {
> "using": [ "urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail" ],
> "methodCalls": [
> [
> "Mailbox/set",
> {
> "accountId": "JMAP-ID",
> "ifInState": null,
> "create": {
> "TEMP-MAILBOX-ID": {
> "name": "mailbox_name",
> "namespace": "Personal"
> }
> }
> }
> ]
> ]
> }
> {code}
> For now, this should be enough. Few notes:
> * ifInState is a State and is not managed at the moment, so it should be null
> * the Roles will be the ones we already have defined in james, knowing we
> probably miss others at the moment (see #1750)
> * parentId will be handled in #1737
> * isSubscribed will be handled in #1739
> * sortOrder is not handled yet, we attribute default values depending of the
> role (see #1749 )
> * other missing fields are server-set
> * namespace is not part of the specs
> * rights are handled in #1759
> * for now we can consider role and sortOrder server-set, regarding our
> current implementation
> *Response*
> {code:json}
> {
> "methodResponses": [
> [
> "Mailbox/set",
> {
> "accountId": "JMAP-ID", // the requested accountId
> "oldState": null,
> "newState": null,
> "created": {
> "TEMP-MAILBOX-ID": {
> "id": "0001",
> "sortOrder": 10,
> "role": "Inbox",
> "totalEmails": 0,
> "unreadEmails": 0,
> "totalThreads": 0,
> "unreadThreads": 0,
> "myRights": {
> "mayReadItems":false,
> "mayAddItems":true,
> "mayRemoveItems":false,
> "maySetSeen":true,
> "maySetKeywords":false,
> "mayCreateChild":true,
> "mayRename":true,
> "mayDelete":false,
> "maySubmit":false
> },
> "quotas":{
> "quotaRoot":{
> "Message":{"used":18,"max":42},
> "Storage":{"used":12}
> }
> }
> }
> }
> }
> ]
> ],
> "sessionState": "abc"
> }
> {code}
> Notes:
> * notCreated will be handled in #1736
> * the core specs say that the response should return in created a map of Ids
> to their Mailbox object with the real id, including any properties not sent
> by the client (default values ommited by client and server-set values)
> * oldState and newState should be null for now, as we don't manage it atm
> *DoD* : POJO and serialization of the request and response Mailbox/set for
> creation + unit and integration tests
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]