This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
The following commit(s) were added to refs/heads/master by this push: new 17af994c8f posting right in JMAP for subaddressing (#2473) 17af994c8f is described below commit 17af994c8ffbfb1ee0e699ef4fb3348610566a3c Author: florentos17 <fazav...@linagora.com> AuthorDate: Mon Nov 4 14:59:17 2024 +0100 posting right in JMAP for subaddressing (#2473) --- .../james/jmap/rfc8621/contract/MailboxSetMethodContract.scala | 4 ++-- server/protocols/jmap-rfc-8621/doc/specs/spec/mail/rights.mdown | 1 + .../src/main/scala/org/apache/james/jmap/mail/Rights.scala | 3 ++- .../src/test/scala/org/apache/james/jmap/mail/RightsTest.scala | 5 ++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala index 8c36e10f0e..5298654526 100644 --- a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala +++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxSetMethodContract.scala @@ -5944,7 +5944,7 @@ trait MailboxSetMethodContract { | "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6", | "update": { | "${mailboxId.serialize}": { - | "sharedWith/${ANDRE.asString()}": ["p"] + | "sharedWith/${ANDRE.asString()}": ["x"] | } | } | }, @@ -5980,7 +5980,7 @@ trait MailboxSetMethodContract { | "notUpdated": { | "${mailboxId.serialize}": { | "type": "invalidArguments", - | "description": "Specified value do not match the expected JSON format: List(((0),List(JsonValidationError(List(Unknown right 'p'),List()))))", + | "description": "Specified value do not match the expected JSON format: List(((0),List(JsonValidationError(List(Unknown right 'x'),List()))))", | "properties": [ | "sharedWith/an...@domain.tld" | ] diff --git a/server/protocols/jmap-rfc-8621/doc/specs/spec/mail/rights.mdown b/server/protocols/jmap-rfc-8621/doc/specs/spec/mail/rights.mdown index c6ea337555..335cd54519 100644 --- a/server/protocols/jmap-rfc-8621/doc/specs/spec/mail/rights.mdown +++ b/server/protocols/jmap-rfc-8621/doc/specs/spec/mail/rights.mdown @@ -39,6 +39,7 @@ The following `Right`s are defined: - `"w"` Write: the user can alter the Keywords of messages contained in this Mailbox, except the `$Seen` keyword - `"s"` Seen: the user can alter the `$Seen` keyword of messages contained in this Mailbox - `"e"` Expunge: the user can mark Email as Expunged in this Mailbox. This action is not achievable using JMAP. + - `"p"` Post: the user can send an Email to this Mailbox. This is used with the identifier `anyone` in the context of subaddressing. `UserRights` is an array of `Right`, representing the actions a user can perform on a mailbox. diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/Rights.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/Rights.scala index b274f0b39a..5b8fe06732 100644 --- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/Rights.scala +++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/mail/Rights.scala @@ -67,8 +67,9 @@ object Right { val Seen = Right(JavaRight.WriteSeenFlag) val DeleteMessages = Right(JavaRight.DeleteMessages) val Write = Right(JavaRight.Write) + val Post = Right(JavaRight.Post) - private val allRights = Seq(Administer, Expunge, Insert, Lookup, Read, Seen, DeleteMessages, Write) + private val allRights = Seq(Administer, Expunge, Insert, Lookup, Read, Seen, DeleteMessages, Write, Post) def forRight(right: JavaRight): Option[Right] = allRights.find(_.right.equals(right)) diff --git a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/mail/RightsTest.scala b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/mail/RightsTest.scala index 39f561a48d..cae2864741 100644 --- a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/mail/RightsTest.scala +++ b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/mail/RightsTest.scala @@ -54,6 +54,9 @@ class RightsTest extends AnyWordSpec with Matchers { "recognise 't'" in { Right.forChar('t') must be(Some(Right.DeleteMessages)) } + "recognise 'p'" in { + Right.forChar('p') must be(Some(Right.Post)) + } "return empty when unknown" in { Right.forChar('k') must be(None) } @@ -79,7 +82,7 @@ class RightsTest extends AnyWordSpec with Matchers { } "filter out unknown rights" in { val acl = new JavaMailboxACL(Map( - EntryKey.createUserEntryKey(USERNAME) -> JavaRfc4314Rights.fromSerializedRfc4314Rights("aetpk")).asJava) + EntryKey.createUserEntryKey(USERNAME) -> JavaRfc4314Rights.fromSerializedRfc4314Rights("aetxk")).asJava) Rights.fromACL(MailboxACL.fromJava(acl)) must be(Rights.of(USERNAME, Seq(Right.Administer, Right.Expunge, Right.DeleteMessages))) } --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org