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 1dcfac3332 [FIX] Modified server set identities may not be deletes 
(#2083)
1dcfac3332 is described below

commit 1dcfac3332a2d6f868aa8c9c525b89434c1e3be9
Author: Benoit TELLIER <btell...@linagora.com>
AuthorDate: Tue Mar 5 11:49:51 2024 +0100

    [FIX] Modified server set identities may not be deletes (#2083)
---
 .../org/apache/james/jmap/api/identity/CustomIdentityDAO.scala      | 4 ++--
 .../org/apache/james/jmap/api/identity/IdentityRepositoryTest.scala | 6 +++---
 .../apache/james/jmap/rfc8621/contract/IdentitySetContract.scala    | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
 
b/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
index f68d3cc092..8aa0f2bc5d 100644
--- 
a/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
+++ 
b/server/data/data-jmap/src/main/scala/org/apache/james/jmap/api/identity/CustomIdentityDAO.scala
@@ -259,13 +259,13 @@ object IdentityWithOrigin {
   case class CustomIdentityOrigin(inputIdentity: Identity) extends 
IdentityWithOrigin {
     override def identity: Identity = inputIdentity
 
-    override def merge(other: IdentityWithOrigin): IdentityWithOrigin = this
+    override def merge(other: IdentityWithOrigin): IdentityWithOrigin = 
CustomIdentityOrigin(identity.copy(mayDelete = MayDeleteIdentity(false)))
   }
 
   case class ServerSetIdentityOrigin(inputIdentity: Identity) extends 
IdentityWithOrigin {
     override def identity: Identity = inputIdentity
 
-    override def merge(other: IdentityWithOrigin): IdentityWithOrigin = other
+    override def merge(other: IdentityWithOrigin): IdentityWithOrigin = 
CustomIdentityOrigin(other.identity.copy(mayDelete = MayDeleteIdentity(false)))
   }
 
   def fromCustom(identity: Identity): IdentityWithOrigin = 
CustomIdentityOrigin(identity)
diff --git 
a/server/data/data-jmap/src/test/scala/org/apache/james/jmap/api/identity/IdentityRepositoryTest.scala
 
b/server/data/data-jmap/src/test/scala/org/apache/james/jmap/api/identity/IdentityRepositoryTest.scala
index 075f1abf92..a5d28c2336 100644
--- 
a/server/data/data-jmap/src/test/scala/org/apache/james/jmap/api/identity/IdentityRepositoryTest.scala
+++ 
b/server/data/data-jmap/src/test/scala/org/apache/james/jmap/api/identity/IdentityRepositoryTest.scala
@@ -112,7 +112,7 @@ class IdentityRepositoryTest {
     
when(identityFactory.listIdentities(BOB)).thenReturn(List(differentIdentityWithSameId))
 
     
assertThat(SFlux.fromPublisher(testee.list(BOB)).collectSeq().block().asJava)
-      .containsExactlyInAnyOrder(customIdentity)
+      .containsExactlyInAnyOrder(customIdentity.copy(mayDelete = 
MayDeleteIdentity(false)))
   }
 
   @Test
@@ -191,7 +191,7 @@ class IdentityRepositoryTest {
         bcc = Some(List(EmailAddress(Some(EmailerName("My Boss 2 (updated)")), 
new MailAddress("boss-update...@domain.tld")))),
         textSignature = TextSignature("text 2 signature"),
         htmlSignature = HtmlSignature("html 2 signature"),
-        mayDelete = MayDeleteIdentity(true)))
+        mayDelete = MayDeleteIdentity(false)))
   }
 
   @Test
@@ -213,7 +213,7 @@ class IdentityRepositoryTest {
         bcc = Some(List(EmailAddress(Some(EmailerName("My Boss 2 (updated)")), 
new MailAddress("boss-update...@domain.tld")))),
         textSignature = TextSignature("text 2 signature"),
         htmlSignature = HtmlSignature("html 2 signature"),
-        mayDelete = MayDeleteIdentity(true)))
+        mayDelete = MayDeleteIdentity(false)))
   }
 
   @Test
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/IdentitySetContract.scala
 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/IdentitySetContract.scala
index f83d45a1c9..9dceb93306 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/IdentitySetContract.scala
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/IdentitySetContract.scala
@@ -1963,7 +1963,7 @@ trait IdentitySetContract {
            |                        ],
            |                        "textSignature": "Difference text 
signature",
            |                        "htmlSignature": "<p>Difference html 
signature</p>",
-           |                        "mayDelete": true
+           |                        "mayDelete": false
            |                    }
            |                ]
            |            },


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to