This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 8f2d00127feca06aa5005fbb0ccc8a802f79c45b
Author: Benoit TELLIER <btell...@linagora.com>
AuthorDate: Fri Oct 11 18:40:45 2024 +0200

    JAMES-2182 Base test suite regarding IMAP right enforcements
---
 .../org/apache/james/mpt/api/ImapHostSystem.java   |   2 +
 .../james/mpt/script/ImapScriptedTestProtocol.java |  17 +++
 .../apache/james/mpt/host/JamesImapHostSystem.java |  27 ++++
 .../imapmailbox/suite/IMAPSharingAccessTest.java   | 143 +++++++++++++++++++++
 .../apache/james/imap/scripts/SharingAccessL.test  |  82 ++++++++++++
 .../apache/james/imap/scripts/SharingAccessLR.test | 104 +++++++++++++++
 .../james/imap/scripts/SharingAccessLRA.test       | 106 +++++++++++++++
 .../james/imap/scripts/SharingAccessLRI.test       | 105 +++++++++++++++
 .../james/imap/scripts/SharingAccessLRK.test       | 108 ++++++++++++++++
 .../james/imap/scripts/SharingAccessLRS.test       | 106 +++++++++++++++
 .../james/imap/scripts/SharingAccessLRT.test       | 106 +++++++++++++++
 .../james/imap/scripts/SharingAccessLRTE.test      | 108 ++++++++++++++++
 .../james/imap/scripts/SharingAccessLRW.test       | 106 +++++++++++++++
 .../james/imap/scripts/SharingAccessLRX.test       | 105 +++++++++++++++
 .../imapmailbox/cyrus/host/CyrusHostSystem.java    |   5 +
 .../inmemory/InMemoryIMAPSharingAccessTest.java}   |  35 ++---
 16 files changed, 1250 insertions(+), 15 deletions(-)

diff --git 
a/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java 
b/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
index 44980e5e0c..4b246a0a94 100644
--- a/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
+++ b/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
@@ -31,6 +31,8 @@ public interface ImapHostSystem extends HostSystem {
     
     void createMailbox(MailboxPath mailboxPath) throws Exception;
 
+    void fillMailbox(MailboxPath mailboxPath) throws Exception;
+
     void setQuotaLimits(QuotaCountLimit maxMessageQuota, QuotaSizeLimit 
maxStorageQuota) throws Exception;
 
     void grantRights(MailboxPath mailboxPath, Username userName, 
MailboxACL.Rfc4314Rights rights) throws Exception;
diff --git 
a/mpt/core/src/main/java/org/apache/james/mpt/script/ImapScriptedTestProtocol.java
 
b/mpt/core/src/main/java/org/apache/james/mpt/script/ImapScriptedTestProtocol.java
index 5a5f8b34d7..c58f63d360 100644
--- 
a/mpt/core/src/main/java/org/apache/james/mpt/script/ImapScriptedTestProtocol.java
+++ 
b/mpt/core/src/main/java/org/apache/james/mpt/script/ImapScriptedTestProtocol.java
@@ -40,6 +40,19 @@ public class ImapScriptedTestProtocol extends 
GenericSimpleScriptedTestProtocol<
         }
     }
 
+    private static class FillMailbox implements PrepareCommand<ImapHostSystem> 
{
+        final MailboxPath mailboxPath;
+
+        FillMailbox(MailboxPath mailboxPath) {
+            this.mailboxPath = mailboxPath;
+        }
+
+        @Override
+        public void prepare(ImapHostSystem system) throws Exception {
+            system.fillMailbox(mailboxPath);
+        }
+    }
+
     private static class CreateRights implements 
PrepareCommand<ImapHostSystem> {
 
         final MailboxPath mailboxPath;
@@ -67,6 +80,10 @@ public class ImapScriptedTestProtocol extends 
GenericSimpleScriptedTestProtocol<
         return withPreparedCommand(new CreateMailbox(mailboxPath));
     }
 
+    public ImapScriptedTestProtocol withFilledMailbox(MailboxPath mailboxPath) 
{
+        return withPreparedCommand(new FillMailbox(mailboxPath));
+    }
+
     public ImapScriptedTestProtocol withRights(MailboxPath mailboxPath, 
Username username, MailboxACL.Rfc4314Rights rights) {
         return withPreparedCommand(new CreateRights(mailboxPath, username, 
rights));
     }
diff --git 
a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
 
b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
index eb48f6fe0c..538c176098 100644
--- 
a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
+++ 
b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/host/JamesImapHostSystem.java
@@ -19,6 +19,8 @@
 
 package org.apache.james.mpt.host;
 
+import java.util.stream.IntStream;
+
 import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.apache.commons.configuration2.plist.PropertyListConfiguration;
@@ -37,6 +39,8 @@ import org.apache.james.mailbox.Authenticator;
 import org.apache.james.mailbox.Authorizator;
 import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxSession;
+import org.apache.james.mailbox.MessageManager;
+import org.apache.james.mailbox.exception.MailboxExistsException;
 import org.apache.james.mailbox.model.MailboxACL;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mpt.api.Continuation;
@@ -46,6 +50,8 @@ import org.apache.james.mpt.helper.ByteBufferOutputStream;
 import org.apache.james.mpt.imapmailbox.GrantRightsOnHost;
 import org.apache.james.user.memory.MemoryUsersRepository;
 
+import com.github.fge.lambdas.Throwing;
+
 public abstract class JamesImapHostSystem implements ImapHostSystem, 
GrantRightsOnHost {
     private static final DomainList NO_DOMAIN_LIST = null;
 
@@ -108,6 +114,27 @@ public abstract class JamesImapHostSystem implements 
ImapHostSystem, GrantRights
         mailboxManager.endProcessingRequest(mailboxSession);
     }
 
+    @Override
+    public void fillMailbox(MailboxPath mailboxPath) throws Exception {
+        MailboxManager mailboxManager = getMailboxManager();
+        MailboxSession mailboxSession = 
mailboxManager.createSystemSession(mailboxPath.getUser());
+        mailboxManager.startProcessingRequest(mailboxSession);
+
+        try {
+            mailboxManager.createMailbox(mailboxPath, mailboxSession);
+        } catch (MailboxExistsException e) {
+            // ignore
+        }
+        MessageManager mailbox = mailboxManager.getMailbox(mailboxPath, 
mailboxSession);
+
+        IntStream.range(0, 10)
+            .forEach(Throwing.intConsumer(i ->
+                mailbox.appendMessage(MessageManager.AppendCommand.builder()
+                    .build("Subject: " + mailboxPath.getName() + " " + i + 
"\r\n\r\nBODY " + i + "\r\n"), mailboxSession)));
+
+        mailboxManager.endProcessingRequest(mailboxSession);
+    }
+
     @Override
     public void grantRights(MailboxPath mailboxPath, Username username, 
MailboxACL.Rfc4314Rights rights) throws Exception {
         MailboxManager mailboxManager = getMailboxManager();
diff --git 
a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/IMAPSharingAccessTest.java
 
b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/IMAPSharingAccessTest.java
new file mode 100644
index 0000000000..9f4b67cf97
--- /dev/null
+++ 
b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/IMAPSharingAccessTest.java
@@ -0,0 +1,143 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.mpt.imapmailbox.suite;
+
+import java.util.Locale;
+
+import org.apache.james.core.Username;
+import org.apache.james.mailbox.model.MailboxACL;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.ImapTestConstants;
+import org.apache.james.mpt.imapmailbox.suite.base.BasicImapCommands;
+import org.apache.james.mpt.script.ImapScriptedTestProtocol;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+public abstract class IMAPSharingAccessTest implements ImapTestConstants {
+    public static final Username OTHER_USER_NAME = Username.of("Boby");
+    public static final String OTHER_USER_PASSWORD = "password";
+
+    protected abstract ImapHostSystem createImapHostSystem();
+
+    private ImapHostSystem system;
+    private ImapScriptedTestProtocol scriptedTestProtocol;
+
+    @BeforeEach
+    public void setUp() throws Exception {
+        system = createImapHostSystem();
+        scriptedTestProtocol = new 
ImapScriptedTestProtocol("/org/apache/james/imap/scripts/", system)
+            .withUser(USER, PASSWORD)
+            .withUser(OTHER_USER_NAME, OTHER_USER_PASSWORD)
+            .withFilledMailbox(MailboxPath.inbox(USER))
+            .withFilledMailbox(MailboxPath.forUser(OTHER_USER_NAME, 
"mailbox-l"))
+            .withRights(MailboxPath.forUser(OTHER_USER_NAME, "mailbox-l"), 
USER, MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights("l"))
+            .withFilledMailbox(MailboxPath.forUser(OTHER_USER_NAME, 
"mailbox-lr"))
+            .withRights(MailboxPath.forUser(OTHER_USER_NAME, "mailbox-lr"), 
USER, MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights("lr"))
+            .withFilledMailbox(MailboxPath.forUser(OTHER_USER_NAME, 
"mailbox-lrs"))
+            .withRights(MailboxPath.forUser(OTHER_USER_NAME, "mailbox-lrs"), 
USER, MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights("lrs"))
+            .withFilledMailbox(MailboxPath.forUser(OTHER_USER_NAME, 
"mailbox-lrw"))
+            .withRights(MailboxPath.forUser(OTHER_USER_NAME, "mailbox-lrw"), 
USER, MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights("lrw"))
+            .withFilledMailbox(MailboxPath.forUser(OTHER_USER_NAME, 
"mailbox-lri"))
+            .withRights(MailboxPath.forUser(OTHER_USER_NAME, "mailbox-lri"), 
USER, MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights("lri"))
+            .withFilledMailbox(MailboxPath.forUser(OTHER_USER_NAME, 
"mailbox-lrk"))
+            .withRights(MailboxPath.forUser(OTHER_USER_NAME, "mailbox-lrk"), 
USER, MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights("lrk"))
+            .withFilledMailbox(MailboxPath.forUser(OTHER_USER_NAME, 
"mailbox-lrx"))
+            .withRights(MailboxPath.forUser(OTHER_USER_NAME, "mailbox-lrx"), 
USER, MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights("lrx"))
+            .withFilledMailbox(MailboxPath.forUser(OTHER_USER_NAME, 
"mailbox-lrt")) // todo
+            .withRights(MailboxPath.forUser(OTHER_USER_NAME, "mailbox-lrt"), 
USER, MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights("lrt"))
+            .withFilledMailbox(MailboxPath.forUser(OTHER_USER_NAME, 
"mailbox-lrte")) // todo
+            .withRights(MailboxPath.forUser(OTHER_USER_NAME, "mailbox-lrte"), 
USER, MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights("lrte"))
+            .withFilledMailbox(MailboxPath.forUser(OTHER_USER_NAME, 
"mailbox-lra"))
+            .withRights(MailboxPath.forUser(OTHER_USER_NAME, "mailbox-lra"), 
USER, MailboxACL.Rfc4314Rights.fromSerializedRfc4314Rights("lra"));
+        BasicImapCommands.welcome(scriptedTestProtocol);
+        BasicImapCommands.authenticate(scriptedTestProtocol);
+    }
+
+    @Test
+    public void testMailboxL() throws Exception {
+        scriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SharingAccessL");
+    }
+
+    @Test
+    public void testMailboxLR() throws Exception {
+        scriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SharingAccessLR");
+    }
+
+    @Test
+    public void testMailboxLRS() throws Exception {
+        scriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SharingAccessLRS");
+    }
+
+    @Test
+    public void testMailboxLRK() throws Exception {
+        scriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SharingAccessLRK");
+    }
+
+    @Test
+    public void testMailboxLRX() throws Exception {
+        scriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SharingAccessLRX");
+    }
+
+    @Test
+    public void testMailboxLRA() throws Exception {
+        scriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SharingAccessLRA");
+    }
+
+    @Test
+    public void testMailboxLRI() throws Exception {
+        scriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SharingAccessLRI");
+    }
+
+    @Test
+    public void testMailboxLRW() throws Exception {
+        scriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SharingAccessLRW");
+    }
+
+    @Test
+    public void testMailboxLRT() throws Exception {
+        scriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SharingAccessLRT");
+    }
+
+    @Test
+    public void testMailboxLRTE() throws Exception {
+        scriptedTestProtocol
+            .withLocale(Locale.US)
+            .run("SharingAccessLRTE");
+    }
+}
diff --git 
a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessL.test
 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessL.test
new file mode 100644
index 0000000000..60d9f64d04
--- /dev/null
+++ 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessL.test
@@ -0,0 +1,82 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+
+# Can list other users delegated mailbox
+C: a0 LIST "" "*"
+SUB {
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-l\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lr\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrs\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrw\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lri\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrk\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrx\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrt\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrte\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lra\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"INBOX\"
+}
+S: a0 OK LIST completed.
+
+C: a1 MYRIGHTS #user.boby.mailbox-l
+S: \* MYRIGHTS \"#user.boby.mailbox-l\" \"l\"
+S: a1 OK MYRIGHTS completed.
+
+# TODO should have had failed
+C: a2 STATUS #user.boby.mailbox-l (MESSAGES)
+S: \* STATUS \"#user.boby.mailbox-l\" \(MESSAGES 0\)
+S: a2 OK STATUS completed.
+
+# Ensure we cannot write in the mailbox
+C: a4 SELECT INBOX
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS \(.*\)\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a4 OK \[READ-WRITE\] SELECT completed.
+C: a4 COPY 1:* #user.boby.mailbox-l
+S: a4 NO COPY processing failed.
+
+C: a5 DELETE #user.boby.mailbox-l
+S: a5 NO DELETE failed. No such mailbox.
+
+C: a5 SETACL #user.boby.mailbox-l imapuser lra
+S: a5 NO SETACL You need the Administer right to perform command SETACL on 
mailbox #user.boby.mailbox-l.
+
+C: a7 CREATE #user.boby.mailbox-l.evev
+S: a7 NO CREATE processing failed.
+
+# TODO should have had failed
+C: a3 SELECT #user.boby.mailbox-l
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[PERMANENTFLAGS\] No permanent flags permitted
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a3 OK \[READ-ONLY\] SELECT completed.
+
+
diff --git 
a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLR.test
 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLR.test
new file mode 100644
index 0000000000..1e6e2a4595
--- /dev/null
+++ 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLR.test
@@ -0,0 +1,104 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+
+# Can list other users delegated mailbox
+C: a0 LIST "" "*"
+SUB {
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-l\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lr\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrs\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrw\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lri\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrk\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrx\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrt\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrte\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lra\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"INBOX\"
+}
+S: a0 OK LIST completed.
+
+C: a1 MYRIGHTS #user.boby.mailbox-lr
+S: \* MYRIGHTS \"#user.boby.mailbox-lr\" \"lr\"
+S: a1 OK MYRIGHTS completed.
+
+C: a2 STATUS #user.boby.mailbox-lr (MESSAGES)
+S: \* STATUS \"#user.boby.mailbox-lr\" \(MESSAGES 10\)
+S: a2 OK STATUS completed.
+
+# Ensure we cannot write in the mailbox
+C: a4 SELECT INBOX
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS \(.*\)\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a4 OK \[READ-WRITE\] SELECT completed.
+C: a4 COPY 1:* #user.boby.mailbox-lr
+S: a4 NO COPY processing failed.
+C: a6 UNSELECT
+S: a6 OK UNSELECT completed.
+
+C: a5 DELETE #user.boby.mailbox-lr
+S: a5 NO DELETE failed. No such mailbox.
+
+C: a5 SETACL #user.boby.mailbox-lr imapuser lra
+S: a5 NO SETACL You need the Administer right to perform command SETACL on 
mailbox #user.boby.mailbox-lr.
+
+C: a7 CREATE #user.boby.mailbox-lr.evev
+S: a7 NO CREATE processing failed.
+
+C: a3 SELECT #user.boby.mailbox-lr
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS .*\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a3 OK \[READ-ONLY\] SELECT completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+C: F12 STORE 1 +FLAGS (\Deleted)
+S: F12 NO STORE failed. Save failed.
+
+C: F13 STORE 1 +FLAGS (\Seen)
+S: F13 NO STORE failed. Save failed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: F14 NO STORE failed. Save failed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: F14 NO STORE failed. Save failed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+C: F15 EXPUNGE
+S: F15 NO EXPUNGE failed. Mailbox is read only.
\ No newline at end of file
diff --git 
a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRA.test
 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRA.test
new file mode 100644
index 0000000000..49975b13c0
--- /dev/null
+++ 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRA.test
@@ -0,0 +1,106 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+
+# Can list other users delegated mailbox
+C: a0 LIST "" "*"
+SUB {
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-l\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lr\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrs\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrw\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lri\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrx\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrk\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrt\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrte\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lra\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"INBOX\"
+}
+S: a0 OK LIST completed.
+
+C: a1 MYRIGHTS #user.boby.mailbox-lra
+S: \* MYRIGHTS \"#user.boby.mailbox-lra\" \"alr\"
+S: a1 OK MYRIGHTS completed.
+
+C: a2 STATUS #user.boby.mailbox-lra (MESSAGES)
+S: \* STATUS \"#user.boby.mailbox-lra\" \(MESSAGES 10\)
+S: a2 OK STATUS completed.
+
+# Ensure we cannot write in the mailbox
+C: a4 SELECT INBOX
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS \(.*\)\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a4 OK \[READ-WRITE\] SELECT completed.
+C: a4 COPY 1:* #user.boby.mailbox-lra
+S: a4 NO COPY processing failed.
+C: a6 UNSELECT
+S: a6 OK UNSELECT completed.
+
+C: a5 DELETE #user.boby.mailbox-lra
+S: a5 NO DELETE failed. No such mailbox.
+
+# TODO if I have 'a' right I shall be able to administer!
+# org.apache.james.mailbox.exception.InsufficientRightsException: Setting ACL 
is only permitted to the owner of the mailbox
+C: a5 SETACL #user.boby.mailbox-lra imapuser lra
+S: a5 NO SETACL processing failed.
+
+C: a7 CREATE #user.boby.mailbox-lra.evev
+S: a7 NO CREATE processing failed.
+
+C: a3 SELECT #user.boby.mailbox-lra
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS .*\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a3 OK \[READ-ONLY\] SELECT completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+C: F12 STORE 1 +FLAGS (\Deleted)
+S: F12 NO STORE failed. Save failed.
+
+C: F13 STORE 1 +FLAGS (\Seen)
+S: F13 NO STORE failed. Save failed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: F14 NO STORE failed. Save failed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: F14 NO STORE failed. Save failed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+C: F15 EXPUNGE
+S: F15 NO EXPUNGE failed. Mailbox is read only.
\ No newline at end of file
diff --git 
a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRI.test
 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRI.test
new file mode 100644
index 0000000000..4a6e71579e
--- /dev/null
+++ 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRI.test
@@ -0,0 +1,105 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+
+# Can list other users delegated mailbox
+C: a0 LIST "" "*"
+SUB {
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-l\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lr\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrs\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrw\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lri\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrk\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrx\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrt\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrte\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lra\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"INBOX\"
+}
+S: a0 OK LIST completed.
+
+C: a1 MYRIGHTS #user.boby.mailbox-lri
+S: \* MYRIGHTS \"#user.boby.mailbox-lri\" \"ilr\"
+S: a1 OK MYRIGHTS completed.
+
+C: a2 STATUS #user.boby.mailbox-lri (MESSAGES)
+S: \* STATUS \"#user.boby.mailbox-lri\" \(MESSAGES 10\)
+S: a2 OK STATUS completed.
+
+# Ensure we cannot write in the mailbox
+C: a4 SELECT INBOX
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS \(.*\)\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a4 OK \[READ-WRITE\] SELECT completed.
+C: a4 COPY 1:* #user.boby.mailbox-lri
+S: a4 OK .* COPY completed.
+C: a6 UNSELECT
+S: a6 OK UNSELECT completed.
+
+C: a5 DELETE #user.boby.mailbox-lri
+S: a5 NO DELETE failed. No such mailbox.
+
+C: a5 SETACL #user.boby.mailbox-lri imapuser lra
+S: a5 NO SETACL You need the Administer right to perform command SETACL on 
mailbox #user.boby.mailbox-lri.
+
+C: a7 CREATE #user.boby.mailbox-lri.evev
+S: a7 NO CREATE processing failed.
+
+C: a3 SELECT #user.boby.mailbox-lri
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS .*\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a3 OK \[READ-WRITE\] SELECT completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+# TODO Insert is not flags
+C: F12 STORE 1 +FLAGS (\Deleted)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Recent\)\)
+S: F12 OK STORE completed.
+
+C: F13 STORE 1 +FLAGS (\Seen)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Recent \\Seen\)\)
+S: F13 OK STORE completed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Flagged \\Recent \\Seen\)\)
+S: F14 OK STORE completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Flagged \\Recent \\Seen\)\)
+S: F11 OK FETCH completed.
+
+C: F15 EXPUNGE
+S: F15 NO EXPUNGE failed. Mailbox is read only.
\ No newline at end of file
diff --git 
a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRK.test
 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRK.test
new file mode 100644
index 0000000000..34a583572e
--- /dev/null
+++ 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRK.test
@@ -0,0 +1,108 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+
+# Can list other users delegated mailbox
+C: a0 LIST "" "*"
+SUB {
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-l\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lr\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrs\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrw\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lri\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrk\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrx\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrt\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrte\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lra\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"INBOX\"
+}
+S: a0 OK LIST completed.
+
+C: a1 MYRIGHTS #user.boby.mailbox-lrk
+S: \* MYRIGHTS \"#user.boby.mailbox-lrk\" \"klr\"
+S: a1 OK MYRIGHTS completed.
+
+C: a2 STATUS #user.boby.mailbox-lrk (MESSAGES)
+S: \* STATUS \"#user.boby.mailbox-lrk\" \(MESSAGES 10\)
+S: a2 OK STATUS completed.
+
+# Ensure we cannot write in the mailbox
+C: a4 SELECT INBOX
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS \(.*\)\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a4 OK \[READ-WRITE\] SELECT completed.
+C: a4 COPY 1:* #user.boby.mailbox-lrk
+S: a4 NO COPY processing failed.
+C: a6 UNSELECT
+S: a6 OK UNSELECT completed.
+
+C: a5 DELETE #user.boby.mailbox-lrk
+S: a5 NO DELETE failed. No such mailbox.
+
+C: a5 SETACL #user.boby.mailbox-lrk imapuser lra
+S: a5 NO SETACL You need the Administer right to perform command SETACL on 
mailbox #user.boby.mailbox-lrk.
+
+# TODO
+#  - MUST be able to create mailboxes
+#  - When a new mailbox is created, it SHOULD inherit the ACL from the parent 
mailbox (if one exists) in the defined hierarchy.
+# CF 
https://github.com/giz-berlin/james-project/commit/9541be2da2a2da9a5bc5343e20ef152c5b473727#diff-78bbaf3505920ad8d1c2dfb95f2cbc4de2ed01c358645ad50e9b531483e3c25aR342
+C: a7 CREATE #user.boby.mailbox-lrk.evev
+S: a7 NO CREATE processing failed.
+
+C: a3 SELECT #user.boby.mailbox-lrk
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS .*\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a3 OK \[READ-ONLY\] SELECT completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+C: F12 STORE 1 +FLAGS (\Deleted)
+S: F12 NO STORE failed. Save failed.
+
+C: F13 STORE 1 +FLAGS (\Seen)
+S: F13 NO STORE failed. Save failed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: F14 NO STORE failed. Save failed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: F14 NO STORE failed. Save failed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+C: F15 EXPUNGE
+S: F15 NO EXPUNGE failed. Mailbox is read only.
\ No newline at end of file
diff --git 
a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRS.test
 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRS.test
new file mode 100644
index 0000000000..add7607bf1
--- /dev/null
+++ 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRS.test
@@ -0,0 +1,106 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+
+# Can list other users delegated mailbox
+C: a0 LIST "" "*"
+SUB {
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-l\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lr\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrs\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrw\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lri\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrk\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrx\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrt\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrte\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lra\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"INBOX\"
+}
+S: a0 OK LIST completed.
+
+C: a1 MYRIGHTS #user.boby.mailbox-lrs
+S: \* MYRIGHTS \"#user.boby.mailbox-lrs\" \"lrs\"
+S: a1 OK MYRIGHTS completed.
+
+C: a2 STATUS #user.boby.mailbox-lrs (MESSAGES)
+S: \* STATUS \"#user.boby.mailbox-lrs\" \(MESSAGES 10\)
+S: a2 OK STATUS completed.
+
+# Ensure we cannot write in the mailbox
+C: a4 SELECT INBOX
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS \(.*\)\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a4 OK \[READ-WRITE\] SELECT completed.
+# TODO WTF I do not have 'i' right but I can copy?
+C: a4 COPY 1:* #user.boby.mailbox-lrs
+S: a4 OK .* COPY completed.
+C: a6 UNSELECT
+S: a6 OK UNSELECT completed.
+
+C: a5 DELETE #user.boby.mailbox-lrs
+S: a5 NO DELETE failed. No such mailbox.
+
+C: a5 SETACL #user.boby.mailbox-lrs imapuser lra
+S: a5 NO SETACL You need the Administer right to perform command SETACL on 
mailbox #user.boby.mailbox-lrs.
+
+C: a7 CREATE #user.boby.mailbox-lrs.evev
+S: a7 NO CREATE processing failed.
+
+C: a3 SELECT #user.boby.mailbox-lrs
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS .*\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a3 OK \[READ-WRITE\] SELECT completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+# TODO I shall only be able to manipulate \\Seen...
+C: F12 STORE 1 +FLAGS (\Deleted)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Recent\)\)
+S: F12 OK STORE completed.
+
+C: F13 STORE 1 +FLAGS (\Seen)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Recent \\Seen\)\)
+S: F13 OK STORE completed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Flagged \\Recent \\Seen\)\)
+S: F14 OK STORE completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Flagged \\Recent \\Seen\)\)
+S: F11 OK FETCH completed.
+
+C: F15 EXPUNGE
+S: F15 NO EXPUNGE failed. Mailbox is read only.
\ No newline at end of file
diff --git 
a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRT.test
 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRT.test
new file mode 100644
index 0000000000..4dab79df20
--- /dev/null
+++ 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRT.test
@@ -0,0 +1,106 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+
+# Can list other users delegated mailbox
+C: a0 LIST "" "*"
+SUB {
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-l\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lr\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrs\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrw\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lri\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrk\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrx\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrt\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrte\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lra\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"INBOX\"
+}
+S: a0 OK LIST completed.
+
+C: a1 MYRIGHTS #user.boby.mailbox-lrt
+S: \* MYRIGHTS \"#user.boby.mailbox-lrt\" \"lrt\"
+S: a1 OK MYRIGHTS completed.
+
+C: a2 STATUS #user.boby.mailbox-lrt (MESSAGES)
+S: \* STATUS \"#user.boby.mailbox-lrt\" \(MESSAGES 10\)
+S: a2 OK STATUS completed.
+
+# Ensure we cannot write in the mailbox
+C: a4 SELECT INBOX
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS \(.*\)\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a4 OK \[READ-WRITE\] SELECT completed.
+# TODO WTF I do not have 'i' right but I can copy?
+C: a4 COPY 1:* #user.boby.mailbox-lrt
+S: a4 OK .* COPY completed.
+C: a6 UNSELECT
+S: a6 OK UNSELECT completed.
+
+C: a5 DELETE #user.boby.mailbox-lrt
+S: a5 NO DELETE failed. No such mailbox.
+
+C: a5 SETACL #user.boby.mailbox-lrt imapuser lra
+S: a5 NO SETACL You need the Administer right to perform command SETACL on 
mailbox #user.boby.mailbox-lrt.
+
+C: a7 CREATE #user.boby.mailbox-lrt.evev
+S: a7 NO CREATE processing failed.
+
+C: a3 SELECT #user.boby.mailbox-lrt
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS .*\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a3 OK \[READ-WRITE\] SELECT completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+C: F12 STORE 1 +FLAGS (\Deleted)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Recent\)\)
+S: F12 OK STORE completed.
+
+# TODO I shall only be able to manipulate \\Deleted...
+C: F13 STORE 1 +FLAGS (\Seen)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Recent \\Seen\)\)
+S: F13 OK STORE completed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Flagged \\Recent \\Seen\)\)
+S: F14 OK STORE completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Flagged \\Recent \\Seen\)\)
+S: F11 OK FETCH completed.
+
+C: F15 EXPUNGE
+S: F15 NO EXPUNGE failed. Mailbox is read only.
\ No newline at end of file
diff --git 
a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRTE.test
 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRTE.test
new file mode 100644
index 0000000000..30c9d77e9a
--- /dev/null
+++ 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRTE.test
@@ -0,0 +1,108 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+
+# Can list other users delegated mailbox
+C: a0 LIST "" "*"
+SUB {
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-l\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lr\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrs\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrw\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lri\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrk\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrx\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrt\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrte\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lra\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"INBOX\"
+}
+S: a0 OK LIST completed.
+
+C: a1 MYRIGHTS #user.boby.mailbox-lrte
+S: \* MYRIGHTS \"#user.boby.mailbox-lrte\" \"elrt\"
+S: a1 OK MYRIGHTS completed.
+
+C: a2 STATUS #user.boby.mailbox-lrte (MESSAGES)
+S: \* STATUS \"#user.boby.mailbox-lrte\" \(MESSAGES 10\)
+S: a2 OK STATUS completed.
+
+# Ensure we cannot write in the mailbox
+C: a4 SELECT INBOX
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS \(.*\)\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a4 OK \[READ-WRITE\] SELECT completed.
+# TODO WTF I do not have 'i' right but I can copy?
+C: a4 COPY 1:* #user.boby.mailbox-lrte
+S: a4 OK .* COPY completed.
+C: a6 UNSELECT
+S: a6 OK UNSELECT completed.
+
+C: a5 DELETE #user.boby.mailbox-lrte
+S: a5 NO DELETE failed. No such mailbox.
+
+C: a5 SETACL #user.boby.mailbox-lrte imapuser lra
+S: a5 NO SETACL You need the Administer right to perform command SETACL on 
mailbox #user.boby.mailbox-lrte.
+
+C: a7 CREATE #user.boby.mailbox-lrte.evev
+S: a7 NO CREATE processing failed.
+
+C: a3 SELECT #user.boby.mailbox-lrte
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS .*\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a3 OK \[READ-WRITE\] SELECT completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+C: F12 STORE 1 +FLAGS (\Deleted)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Recent\)\)
+S: F12 OK STORE completed.
+
+# TODO I shall only be able to manipulate \\Deleted...
+C: F13 STORE 1 +FLAGS (\Seen)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Recent \\Seen\)\)
+S: F13 OK STORE completed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Flagged \\Recent \\Seen\)\)
+S: F14 OK STORE completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Flagged \\Recent \\Seen\)\)
+S: F11 OK FETCH completed.
+
+C: F15 EXPUNGE
+S: \* 1 EXPUNGE
+S: \* 19 RECENT
+S: F15 OK EXPUNGE completed.
\ No newline at end of file
diff --git 
a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRW.test
 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRW.test
new file mode 100644
index 0000000000..c7fb43fa2b
--- /dev/null
+++ 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRW.test
@@ -0,0 +1,106 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+
+# Can list other users delegated mailbox
+C: a0 LIST "" "*"
+SUB {
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-l\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lr\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrs\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrw\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lri\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrk\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrx\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrt\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrte\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lra\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"INBOX\"
+}
+S: a0 OK LIST completed.
+
+C: a1 MYRIGHTS #user.boby.mailbox-lrw
+S: \* MYRIGHTS \"#user.boby.mailbox-lrw\" \"lrw\"
+S: a1 OK MYRIGHTS completed.
+
+C: a2 STATUS #user.boby.mailbox-lrw (MESSAGES)
+S: \* STATUS \"#user.boby.mailbox-lrw\" \(MESSAGES 10\)
+S: a2 OK STATUS completed.
+
+# Ensure we cannot write in the mailbox
+C: a4 SELECT INBOX
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS \(.*\)\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a4 OK \[READ-WRITE\] SELECT completed.
+# TODO WTF I do not have 'i' right but I can copy?
+C: a4 COPY 1:* #user.boby.mailbox-lrw
+S: a4 OK .* COPY completed.
+C: a6 UNSELECT
+S: a6 OK UNSELECT completed.
+
+C: a5 DELETE #user.boby.mailbox-lrw
+S: a5 NO DELETE failed. No such mailbox.
+
+C: a5 SETACL #user.boby.mailbox-lrw imapuser lra
+S: a5 NO SETACL You need the Administer right to perform command SETACL on 
mailbox #user.boby.mailbox-lrw.
+
+C: a7 CREATE #user.boby.mailbox-lrw.evev
+S: a7 NO CREATE processing failed.
+
+C: a3 SELECT #user.boby.mailbox-lrw
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS .*\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a3 OK \[READ-WRITE\] SELECT completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+# TODO I shall only be able to manipulate \\Seen...
+C: F12 STORE 1 +FLAGS (\Deleted)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Recent\)\)
+S: F12 OK STORE completed.
+
+C: F13 STORE 1 +FLAGS (\Seen)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Recent \\Seen\)\)
+S: F13 OK STORE completed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Flagged \\Recent \\Seen\)\)
+S: F14 OK STORE completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Deleted \\Flagged \\Recent \\Seen\)\)
+S: F11 OK FETCH completed.
+
+C: F15 EXPUNGE
+S: F15 NO EXPUNGE failed. Mailbox is read only.
\ No newline at end of file
diff --git 
a/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRX.test
 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRX.test
new file mode 100644
index 0000000000..78548086e7
--- /dev/null
+++ 
b/mpt/impl/imap-mailbox/core/src/main/resources/org/apache/james/imap/scripts/SharingAccessLRX.test
@@ -0,0 +1,105 @@
+################################################################
+# Licensed to the Apache Software Foundation (ASF) under one   #
+# or more contributor license agreements.  See the NOTICE file #
+# distributed with this work for additional information        #
+# regarding copyright ownership.  The ASF licenses this file   #
+# to you under the Apache License, Version 2.0 (the            #
+# "License"); you may not use this file except in compliance   #
+# with the License.  You may obtain a copy of the License at   #
+#                                                              #
+#   http://www.apache.org/licenses/LICENSE-2.0                 #
+#                                                              #
+# Unless required by applicable law or agreed to in writing,   #
+# software distributed under the License is distributed on an  #
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       #
+# KIND, either express or implied.  See the License for the    #
+# specific language governing permissions and limitations      #
+# under the License.                                           #
+################################################################
+
+# Can list other users delegated mailbox
+C: a0 LIST "" "*"
+SUB {
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-l\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lr\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrs\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrw\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lri\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrx\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrk\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrt\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lrte\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"#user.boby.mailbox-lra\"
+S: \* LIST \(\\HasNoChildren\) \".\" \"INBOX\"
+}
+S: a0 OK LIST completed.
+
+C: a1 MYRIGHTS #user.boby.mailbox-lrx
+S: \* MYRIGHTS \"#user.boby.mailbox-lrx\" \"lrx\"
+S: a1 OK MYRIGHTS completed.
+
+C: a2 STATUS #user.boby.mailbox-lrx (MESSAGES)
+S: \* STATUS \"#user.boby.mailbox-lrx\" \(MESSAGES 10\)
+S: a2 OK STATUS completed.
+
+# Ensure we cannot write in the mailbox
+C: a4 SELECT INBOX
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS \(.*\)\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a4 OK \[READ-WRITE\] SELECT completed.
+C: a4 COPY 1:* #user.boby.mailbox-lrx
+S: a4 NO COPY processing failed.
+C: a6 UNSELECT
+S: a6 OK UNSELECT completed.
+
+# TODO x right shall be enough to delete!
+C: a5 DELETE #user.boby.mailbox-lrx
+S: a5 NO DELETE failed. No such mailbox.
+
+C: a5 SETACL #user.boby.mailbox-lrx imapuser lra
+S: a5 NO SETACL You need the Administer right to perform command SETACL on 
mailbox #user.boby.mailbox-lrx.
+
+C: a7 CREATE #user.boby.mailbox-lrx.evev
+S: a7 NO CREATE processing failed.
+
+C: a3 SELECT #user.boby.mailbox-lrx
+S: \* OK \[MAILBOXID \(.*\)\] Ok
+S: \* FLAGS \(.*\)
+S: \* .* EXISTS
+S: \* .* RECENT
+S: \* OK \[UIDVALIDITY .*\] UIDs valid
+S: \* OK \[UNSEEN 1\] MailboxMessage 1 is first unseen
+S: \* OK \[PERMANENTFLAGS .*\] Limited
+S: \* OK \[HIGHESTMODSEQ .*\] Highest
+S: \* OK \[UIDNEXT .*\] Predicted next UID
+S: a3 OK \[READ-ONLY\] SELECT completed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+C: F12 STORE 1 +FLAGS (\Deleted)
+S: F12 NO STORE failed. Save failed.
+
+C: F13 STORE 1 +FLAGS (\Seen)
+S: F13 NO STORE failed. Save failed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: F14 NO STORE failed. Save failed.
+
+C: F14 STORE 1 +FLAGS (\Flagged)
+S: F14 NO STORE failed. Save failed.
+
+C: F11 FETCH 1 FLAGS
+S: \* 1 FETCH \(FLAGS \(\\Recent\)\)
+S: F11 OK FETCH completed.
+
+C: F15 EXPUNGE
+S: F15 NO EXPUNGE failed. Mailbox is read only.
\ No newline at end of file
diff --git 
a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
 
b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
index 5572dcb331..ebda38d9f3 100644
--- 
a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
+++ 
b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java
@@ -134,6 +134,11 @@ public class CyrusHostSystem extends ExternalHostSystem 
implements Provider<Cont
         }
     }
 
+    @Override
+    public void fillMailbox(MailboxPath mailboxPath) throws Exception {
+        throw new NotImplementedException("not implemented");
+    }
+
     @Override
     public void setQuotaLimits(QuotaCountLimit maxMessageQuota, QuotaSizeLimit 
maxStorageQuota) throws Exception {
         throw new NotImplementedException("not implemented");
diff --git 
a/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java 
b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryIMAPSharingAccessTest.java
similarity index 62%
copy from mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
copy to 
mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryIMAPSharingAccessTest.java
index 44980e5e0c..c1cc489dd4 100644
--- a/mpt/core/src/main/java/org/apache/james/mpt/api/ImapHostSystem.java
+++ 
b/mpt/impl/imap-mailbox/inmemory/src/test/java/org/apache/james/mpt/imapmailbox/inmemory/InMemoryIMAPSharingAccessTest.java
@@ -16,22 +16,27 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-package org.apache.james.mpt.api;
 
-import org.apache.james.core.Username;
-import org.apache.james.core.quota.QuotaCountLimit;
-import org.apache.james.core.quota.QuotaSizeLimit;
-import org.apache.james.mailbox.model.MailboxACL;
-import org.apache.james.mailbox.model.MailboxPath;
-import org.apache.james.mpt.api.ImapFeatures.Feature;
+package org.apache.james.mpt.imapmailbox.inmemory;
 
-public interface ImapHostSystem extends HostSystem {
+import org.apache.james.mpt.api.ImapHostSystem;
+import org.apache.james.mpt.imapmailbox.inmemory.host.InMemoryHostSystem;
+import org.apache.james.mpt.imapmailbox.suite.IMAPSharingAccessTest;
+import org.junit.jupiter.api.BeforeEach;
 
-    boolean supports(Feature... features);
-    
-    void createMailbox(MailboxPath mailboxPath) throws Exception;
-
-    void setQuotaLimits(QuotaCountLimit maxMessageQuota, QuotaSizeLimit 
maxStorageQuota) throws Exception;
+public class InMemoryIMAPSharingAccessTest extends IMAPSharingAccessTest {
+    private ImapHostSystem system;
 
-    void grantRights(MailboxPath mailboxPath, Username userName, 
MailboxACL.Rfc4314Rights rights) throws Exception;
-}
\ No newline at end of file
+    @Override
+    @BeforeEach
+    public void setUp() throws Exception {
+        system = new InMemoryHostSystem();
+        system.beforeTest();
+        super.setUp();
+    }
+    
+    @Override
+    protected ImapHostSystem createImapHostSystem() {
+        return system;
+    }
+}


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

Reply via email to