You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/12/13 10:01:10 UTC

[james-project] 05/17: MAILBOX-393 Make JMAP Mailbox update rename proof

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

commit 9f6a148735e276e38949255330e52c3d99b6cde1
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Dec 6 11:53:21 2019 +0700

    MAILBOX-393 Make JMAP Mailbox update rename proof
    
    Before upon concurrent rename, the right can be applied to the wrong mailbox, the
    rename could also be applied to the wrong mailbox.
---
 .../apache/james/jmap/draft/methods/SetMailboxesUpdateProcessor.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/SetMailboxesUpdateProcessor.java b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/SetMailboxesUpdateProcessor.java
index e5d33fa..b64d8d8 100644
--- a/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/SetMailboxesUpdateProcessor.java
+++ b/server/protocols/jmap-draft/src/main/java/org/apache/james/jmap/draft/methods/SetMailboxesUpdateProcessor.java
@@ -259,7 +259,7 @@ public class SetMailboxesUpdateProcessor implements SetMailboxesProcessor {
         MailboxPath originMailboxPath = mailboxManager.getMailbox(mailbox.getId(), mailboxSession).getMailboxPath();
         MailboxPath destinationMailboxPath = computeNewMailboxPath(mailbox, originMailboxPath, updateRequest, mailboxSession);
         if (updateRequest.getSharedWith().isPresent()) {
-            mailboxManager.setRights(originMailboxPath,
+            mailboxManager.setRights(mailbox.getId(),
                 updateRequest.getSharedWith()
                     .get()
                     .removeEntriesFor(originMailboxPath.getUser())
@@ -267,7 +267,7 @@ public class SetMailboxesUpdateProcessor implements SetMailboxesProcessor {
                 mailboxSession);
         }
         if (!originMailboxPath.equals(destinationMailboxPath)) {
-            mailboxManager.renameMailbox(originMailboxPath, destinationMailboxPath, mailboxSession);
+            mailboxManager.renameMailbox(mailbox.getId(), destinationMailboxPath, mailboxSession);
 
             subscriptionManager.unsubscribe(mailboxSession, originMailboxPath.getName());
             subscriptionManager.subscribe(mailboxSession, destinationMailboxPath.getName());


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org