http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailbox.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailbox.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailbox.java index 6727d8e..3650f97 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailbox.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/mail/model/impl/SimpleMailbox.java @@ -22,7 +22,6 @@ import org.apache.james.mailbox.MailboxSession; import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxId; import org.apache.james.mailbox.model.MailboxPath; -import org.apache.james.mailbox.model.SimpleMailboxACL; import org.apache.james.mailbox.store.mail.model.Mailbox; import org.apache.james.mailbox.store.mail.model.MailboxUtil; @@ -36,7 +35,7 @@ public class SimpleMailbox implements Mailbox { private String user; private String name; private final long uidValidity; - private MailboxACL acl = SimpleMailboxACL.EMPTY; + private MailboxACL acl = MailboxACL.EMPTY; public SimpleMailbox(MailboxPath path, long uidValidity, MailboxId mailboxId) { this.id = mailboxId; @@ -56,7 +55,7 @@ public class SimpleMailbox implements Mailbox { this.user = mailbox.getUser(); this.name = mailbox.getName(); this.uidValidity = mailbox.getUidValidity(); - this.acl = new SimpleMailboxACL(mailbox.getACL().getEntries()); + this.acl = new MailboxACL(mailbox.getACL().getEntries()); } /**
http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/mailbox/store/src/test/java/org/apache/james/mailbox/store/TestMailboxSessionMapperFactory.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/TestMailboxSessionMapperFactory.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/TestMailboxSessionMapperFactory.java index 63dd590..85c979a 100644 --- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/TestMailboxSessionMapperFactory.java +++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/TestMailboxSessionMapperFactory.java @@ -139,7 +139,7 @@ public class TestMailboxSessionMapperFactory extends MailboxSessionMapperFactory } @Override - public void updateACL(Mailbox mailbox, MailboxACL.MailboxACLCommand mailboxACLCommand) throws MailboxException { + public void updateACL(Mailbox mailbox, MailboxACL.ACLCommand mailboxACLCommand) throws MailboxException { throw new NotImplementedException(); } http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/MailboxACLJsonConverterTest.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/MailboxACLJsonConverterTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/MailboxACLJsonConverterTest.java new file mode 100644 index 0000000..99bcd8f --- /dev/null +++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/MailboxACLJsonConverterTest.java @@ -0,0 +1,140 @@ +/**************************************************************** + * 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.mailbox.store.json; + +import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson; +import static org.apache.james.mailbox.model.MailboxACL.Right.CreateMailbox; +import static org.apache.james.mailbox.model.MailboxACL.Right.DeleteMailbox; +import static org.apache.james.mailbox.model.MailboxACL.Right.DeleteMessages; +import static org.apache.james.mailbox.model.MailboxACL.Right.Lookup; +import static org.apache.james.mailbox.model.MailboxACL.Right.Post; +import static org.apache.james.mailbox.model.MailboxACL.Right.Read; +import static org.apache.james.mailbox.model.MailboxACL.Right.Write; +import static org.apache.james.mailbox.model.MailboxACL.Right.WriteSeenFlag; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.apache.james.mailbox.model.MailboxACL; +import org.apache.james.mailbox.model.MailboxACL.EntryKey; +import org.apache.james.mailbox.model.MailboxACL.NameType; +import org.apache.james.mailbox.model.MailboxACL.Rfc4314Rights; +import org.junit.Test; + +import net.javacrumbs.jsonunit.core.Option; + +public class MailboxACLJsonConverterTest { + + public class ACLMapBuilder { + private final Map<EntryKey, Rfc4314Rights> map; + + public ACLMapBuilder() { + map = new LinkedHashMap<>(); + } + + public ACLMapBuilder addSingleUserEntryToMap() { + Rfc4314Rights rights = new Rfc4314Rights(CreateMailbox, DeleteMailbox, DeleteMessages, Lookup, Post, Read, WriteSeenFlag, Write); + EntryKey key = new EntryKey("user", NameType.user, true); + map.put(key, rights); + return this; + } + + public ACLMapBuilder addSingleSpecialEntryToMap() { + Rfc4314Rights rights = new Rfc4314Rights(DeleteMailbox, DeleteMessages, Lookup, Post, Write, WriteSeenFlag); + EntryKey key = new EntryKey("special", NameType.special, true); + map.put(key, rights); + return this; + } + + public ACLMapBuilder addSingleGroupEntryToMap() { + + Rfc4314Rights rights = new Rfc4314Rights(DeleteMailbox, DeleteMessages, Lookup, Post, Read, Write, WriteSeenFlag); + EntryKey key = new EntryKey("group", NameType.group, true); + map.put(key, rights); + return this; + } + + public MailboxACL buildAsACL() { + return new MailboxACL(new HashMap<>(map)); + } + + } + + @Test + public void emptyACLShouldBeWellSerialized() throws Exception { + assertThatJson(SimpleMailboxACLJsonConverter.toJson(MailboxACL.EMPTY)) + .isEqualTo("{\"entries\":{}}") + .when(Option.IGNORING_ARRAY_ORDER); + } + + @Test + public void singleUserEntryACLShouldBeWellSerialized() throws Exception { + assertThatJson(SimpleMailboxACLJsonConverter.toJson(new ACLMapBuilder().addSingleUserEntryToMap().buildAsACL())) + .isEqualTo("{\"entries\":{\"-user\":2040}}") + .when(Option.IGNORING_ARRAY_ORDER); + } + + @Test + public void singleGroupEntryACLShouldBeWellSerialized() throws Exception { + assertThatJson(SimpleMailboxACLJsonConverter.toJson(new ACLMapBuilder().addSingleGroupEntryToMap().buildAsACL())) + .isEqualTo("{\"entries\":{\"-$group\":2032}}") + .when(Option.IGNORING_ARRAY_ORDER); + } + + @Test + public void singleSpecialEntryACLShouldBeWellSerialized() throws Exception { + assertThatJson(SimpleMailboxACLJsonConverter.toJson(new ACLMapBuilder().addSingleSpecialEntryToMap().buildAsACL())) + .isEqualTo("{\"entries\":{\"-special\":1968}}") + .when(Option.IGNORING_ARRAY_ORDER); + } + + @Test + public void multipleEntriesACLShouldBeWellSerialized() throws Exception { + assertThatJson(SimpleMailboxACLJsonConverter.toJson(new ACLMapBuilder().addSingleUserEntryToMap().addSingleGroupEntryToMap().buildAsACL())) + .isEqualTo("{\"entries\":{\"-user\":2040,\"-$group\":2032}}") + .when(Option.IGNORING_ARRAY_ORDER); + } + + @Test + public void emptyACLShouldBeWellDeSerialized() throws Exception { + assertThat(SimpleMailboxACLJsonConverter.toACL("{\"entries\":{}}")).isEqualTo(MailboxACL.EMPTY); + } + + @Test + public void singleUserEntryACLShouldBeWellDeSerialized() throws Exception { + assertThatJson(SimpleMailboxACLJsonConverter.toACL("{\"entries\":{\"-user\":2040}}")) + .isEqualTo(new ACLMapBuilder().addSingleUserEntryToMap().buildAsACL()); + } + + @Test + public void singleGroupEntryACLShouldBeWellDeSerialized() throws Exception { + assertThatJson(SimpleMailboxACLJsonConverter.toACL("{\"entries\":{\"-$group\":2032}}")) + .isEqualTo(new ACLMapBuilder().addSingleGroupEntryToMap().buildAsACL()); + } + + @Test + public void multipleEntriesACLShouldBeWellDeSerialized() throws Exception { + assertThatJson(SimpleMailboxACLJsonConverter.toACL("{\"entries\":{\"-user\":2040,\"-$group\":2032}}")) + .isEqualTo(new ACLMapBuilder().addSingleUserEntryToMap().addSingleGroupEntryToMap().buildAsACL()); + } + +} http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/SimpleMailboxACLJsonConverterTest.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/SimpleMailboxACLJsonConverterTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/SimpleMailboxACLJsonConverterTest.java deleted file mode 100644 index b1ae6aa..0000000 --- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/json/SimpleMailboxACLJsonConverterTest.java +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************** - * 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.mailbox.store.json; - -import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson; -import static org.apache.james.mailbox.model.SimpleMailboxACL.Right.CreateMailbox; -import static org.apache.james.mailbox.model.SimpleMailboxACL.Right.DeleteMailbox; -import static org.apache.james.mailbox.model.SimpleMailboxACL.Right.DeleteMessages; -import static org.apache.james.mailbox.model.SimpleMailboxACL.Right.Lookup; -import static org.apache.james.mailbox.model.SimpleMailboxACL.Right.Post; -import static org.apache.james.mailbox.model.SimpleMailboxACL.Right.Read; -import static org.apache.james.mailbox.model.SimpleMailboxACL.Right.Write; -import static org.apache.james.mailbox.model.SimpleMailboxACL.Right.WriteSeenFlag; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; - -import org.apache.james.mailbox.model.MailboxACL; -import org.apache.james.mailbox.model.SimpleMailboxACL; -import org.apache.james.mailbox.model.SimpleMailboxACL.Rfc4314Rights; -import org.junit.Test; - -import net.javacrumbs.jsonunit.core.Option; - -public class SimpleMailboxACLJsonConverterTest { - - public class ACLMapBuilder { - private final Map<SimpleMailboxACL.MailboxACLEntryKey, MailboxACL.MailboxACLRights> map; - - public ACLMapBuilder() { - map = new LinkedHashMap<>(); - } - - public ACLMapBuilder addSingleUserEntryToMap() { - Rfc4314Rights rights = new Rfc4314Rights(CreateMailbox, DeleteMailbox, DeleteMessages, Lookup, Post, Read, WriteSeenFlag, Write); - SimpleMailboxACL.MailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, true); - map.put(key, rights); - return this; - } - - public ACLMapBuilder addSingleSpecialEntryToMap() { - Rfc4314Rights rights = new Rfc4314Rights(DeleteMailbox, DeleteMessages, Lookup, Post, Write, WriteSeenFlag); - SimpleMailboxACL.MailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("special", MailboxACL.NameType.special, true); - map.put(key, rights); - return this; - } - - public ACLMapBuilder addSingleGroupEntryToMap() { - - Rfc4314Rights rights = new Rfc4314Rights(DeleteMailbox, DeleteMessages, Lookup, Post, Read, Write, WriteSeenFlag); - SimpleMailboxACL.MailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("group", MailboxACL.NameType.group, true); - map.put(key, rights); - return this; - } - - public MailboxACL buildAsACL() { - return new SimpleMailboxACL(new HashMap<>(map)); - } - - } - - @Test - public void emptyACLShouldBeWellSerialized() throws Exception { - assertThatJson(SimpleMailboxACLJsonConverter.toJson(SimpleMailboxACL.EMPTY)) - .isEqualTo("{\"entries\":{}}") - .when(Option.IGNORING_ARRAY_ORDER); - } - - @Test - public void singleUserEntryACLShouldBeWellSerialized() throws Exception { - assertThatJson(SimpleMailboxACLJsonConverter.toJson(new ACLMapBuilder().addSingleUserEntryToMap().buildAsACL())) - .isEqualTo("{\"entries\":{\"-user\":2040}}") - .when(Option.IGNORING_ARRAY_ORDER); - } - - @Test - public void singleGroupEntryACLShouldBeWellSerialized() throws Exception { - assertThatJson(SimpleMailboxACLJsonConverter.toJson(new ACLMapBuilder().addSingleGroupEntryToMap().buildAsACL())) - .isEqualTo("{\"entries\":{\"-$group\":2032}}") - .when(Option.IGNORING_ARRAY_ORDER); - } - - @Test - public void singleSpecialEntryACLShouldBeWellSerialized() throws Exception { - assertThatJson(SimpleMailboxACLJsonConverter.toJson(new ACLMapBuilder().addSingleSpecialEntryToMap().buildAsACL())) - .isEqualTo("{\"entries\":{\"-special\":1968}}") - .when(Option.IGNORING_ARRAY_ORDER); - } - - @Test - public void multipleEntriesACLShouldBeWellSerialized() throws Exception { - assertThatJson(SimpleMailboxACLJsonConverter.toJson(new ACLMapBuilder().addSingleUserEntryToMap().addSingleGroupEntryToMap().buildAsACL())) - .isEqualTo("{\"entries\":{\"-user\":2040,\"-$group\":2032}}") - .when(Option.IGNORING_ARRAY_ORDER); - } - - @Test - public void emptyACLShouldBeWellDeSerialized() throws Exception { - assertThat(SimpleMailboxACLJsonConverter.toACL("{\"entries\":{}}")).isEqualTo(SimpleMailboxACL.EMPTY); - } - - @Test - public void singleUserEntryACLShouldBeWellDeSerialized() throws Exception { - assertThatJson(SimpleMailboxACLJsonConverter.toACL("{\"entries\":{\"-user\":2040}}")) - .isEqualTo(new ACLMapBuilder().addSingleUserEntryToMap().buildAsACL()); - } - - @Test - public void singleGroupEntryACLShouldBeWellDeSerialized() throws Exception { - assertThatJson(SimpleMailboxACLJsonConverter.toACL("{\"entries\":{\"-$group\":2032}}")) - .isEqualTo(new ACLMapBuilder().addSingleGroupEntryToMap().buildAsACL()); - } - - @Test - public void multipleEntriesACLShouldBeWellDeSerialized() throws Exception { - assertThatJson(SimpleMailboxACLJsonConverter.toACL("{\"entries\":{\"-user\":2040,\"-$group\":2032}}")) - .isEqualTo(new ACLMapBuilder().addSingleUserEntryToMap().addSingleGroupEntryToMap().buildAsACL()); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMailboxAssertTest.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMailboxAssertTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMailboxAssertTest.java index be5fef4..c4373de 100644 --- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMailboxAssertTest.java +++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/ListMailboxAssertTest.java @@ -19,8 +19,8 @@ package org.apache.james.mailbox.store.mail.model; -import static org.assertj.core.api.Assertions.assertThat; import static org.apache.james.mailbox.store.mail.model.ListMailboxAssert.assertMailboxes; +import static org.assertj.core.api.Assertions.assertThat; import java.util.List; http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperACLTest.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperACLTest.java b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperACLTest.java index 8ba8e8c..ebbb1e9 100644 --- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperACLTest.java +++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/mail/model/MailboxMapperACLTest.java @@ -24,7 +24,6 @@ import static org.assertj.core.api.Assertions.assertThat; import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxPath; -import org.apache.james.mailbox.model.SimpleMailboxACL; import org.apache.james.mailbox.store.mail.MailboxMapper; import org.apache.james.mailbox.store.mail.model.impl.SimpleMailbox; import org.junit.Assume; @@ -72,10 +71,10 @@ public abstract class MailboxMapperACLTest { @Test public void updateAclShouldSaveAclWhenReplace() throws MailboxException { - SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE); - SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew"); + MailboxACL.EntryKey key = new MailboxACL.EntryKey("user", MailboxACL.NameType.user, NEGATIVE); + MailboxACL.Rfc4314Rights rights = new MailboxACL.Rfc4314Rights("asew"); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, + new MailboxACL.ACLCommand(key, MailboxACL.EditMode.REPLACE, rights)); @@ -89,15 +88,15 @@ public abstract class MailboxMapperACLTest { @Test public void updateAclShouldOverrightStoredAclWhenReplace() throws MailboxException { - SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE); - SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew"); - SimpleMailboxACL.Rfc4314Rights newRights = new SimpleMailboxACL.Rfc4314Rights("skate"); + MailboxACL.EntryKey key = new MailboxACL.EntryKey("user", MailboxACL.NameType.user, NEGATIVE); + MailboxACL.Rfc4314Rights rights = new MailboxACL.Rfc4314Rights("asew"); + MailboxACL.Rfc4314Rights newRights = new MailboxACL.Rfc4314Rights("skate"); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, + new MailboxACL.ACLCommand(key, MailboxACL.EditMode.REPLACE, rights)); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, + new MailboxACL.ACLCommand(key, MailboxACL.EditMode.REPLACE, newRights)); @@ -111,16 +110,16 @@ public abstract class MailboxMapperACLTest { @Test public void updateAclShouldTreatNegativeAndPositiveRightSeparately() throws MailboxException { - SimpleMailboxACL.SimpleMailboxACLEntryKey key1 = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE); - SimpleMailboxACL.SimpleMailboxACLEntryKey key2 = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, POSITIVE); - SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew"); - SimpleMailboxACL.Rfc4314Rights newRights = new SimpleMailboxACL.Rfc4314Rights("skate"); + MailboxACL.EntryKey key1 = new MailboxACL.EntryKey("user", MailboxACL.NameType.user, NEGATIVE); + MailboxACL.EntryKey key2 = new MailboxACL.EntryKey("user", MailboxACL.NameType.user, POSITIVE); + MailboxACL.Rfc4314Rights rights = new MailboxACL.Rfc4314Rights("asew"); + MailboxACL.Rfc4314Rights newRights = new MailboxACL.Rfc4314Rights("skate"); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key1, + new MailboxACL.ACLCommand(key1, MailboxACL.EditMode.REPLACE, rights)); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key2, + new MailboxACL.ACLCommand(key2, MailboxACL.EditMode.REPLACE, newRights)); @@ -135,16 +134,16 @@ public abstract class MailboxMapperACLTest { @Test public void updateAclShouldTreatNameTypesRightSeparately() throws MailboxException { - SimpleMailboxACL.SimpleMailboxACLEntryKey key1 = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE); - SimpleMailboxACL.SimpleMailboxACLEntryKey key2 = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.group, NEGATIVE); - SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew"); - SimpleMailboxACL.Rfc4314Rights newRights = new SimpleMailboxACL.Rfc4314Rights("skate"); + MailboxACL.EntryKey key1 = new MailboxACL.EntryKey("user", MailboxACL.NameType.user, NEGATIVE); + MailboxACL.EntryKey key2 = new MailboxACL.EntryKey("user", MailboxACL.NameType.group, NEGATIVE); + MailboxACL.Rfc4314Rights rights = new MailboxACL.Rfc4314Rights("asew"); + MailboxACL.Rfc4314Rights newRights = new MailboxACL.Rfc4314Rights("skate"); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key1, + new MailboxACL.ACLCommand(key1, MailboxACL.EditMode.REPLACE, rights)); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key2, + new MailboxACL.ACLCommand(key2, MailboxACL.EditMode.REPLACE, newRights)); @@ -159,15 +158,15 @@ public abstract class MailboxMapperACLTest { @Test public void updateAclShouldCleanAclEntryWhenEmptyReplace() throws MailboxException { - SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE); - SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew"); - SimpleMailboxACL.Rfc4314Rights newRights = new SimpleMailboxACL.Rfc4314Rights(""); + MailboxACL.EntryKey key = new MailboxACL.EntryKey("user", MailboxACL.NameType.user, NEGATIVE); + MailboxACL.Rfc4314Rights rights = new MailboxACL.Rfc4314Rights("asew"); + MailboxACL.Rfc4314Rights newRights = new MailboxACL.Rfc4314Rights(""); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, + new MailboxACL.ACLCommand(key, MailboxACL.EditMode.REPLACE, rights)); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, + new MailboxACL.ACLCommand(key, MailboxACL.EditMode.REPLACE, newRights)); @@ -180,16 +179,16 @@ public abstract class MailboxMapperACLTest { @Test public void updateAclShouldCombineStoredAclWhenAdd() throws MailboxException { - SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE); - SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew"); - SimpleMailboxACL.Rfc4314Rights newRights = new SimpleMailboxACL.Rfc4314Rights("skate"); - SimpleMailboxACL.Rfc4314Rights bothRights = new SimpleMailboxACL.Rfc4314Rights("asewkt"); + MailboxACL.EntryKey key = new MailboxACL.EntryKey("user", MailboxACL.NameType.user, NEGATIVE); + MailboxACL.Rfc4314Rights rights = new MailboxACL.Rfc4314Rights("asew"); + MailboxACL.Rfc4314Rights newRights = new MailboxACL.Rfc4314Rights("skate"); + MailboxACL.Rfc4314Rights bothRights = new MailboxACL.Rfc4314Rights("asewkt"); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, + new MailboxACL.ACLCommand(key, MailboxACL.EditMode.REPLACE, rights)); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, + new MailboxACL.ACLCommand(key, MailboxACL.EditMode.ADD, newRights)); @@ -203,16 +202,16 @@ public abstract class MailboxMapperACLTest { @Test public void removeAclShouldRemoveSomeStoredAclWhenAdd() throws MailboxException { - SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE); - SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew"); - SimpleMailboxACL.Rfc4314Rights removedRights = new SimpleMailboxACL.Rfc4314Rights("se"); - SimpleMailboxACL.Rfc4314Rights finalRights = new SimpleMailboxACL.Rfc4314Rights("aw"); + MailboxACL.EntryKey key = new MailboxACL.EntryKey("user", MailboxACL.NameType.user, NEGATIVE); + MailboxACL.Rfc4314Rights rights = new MailboxACL.Rfc4314Rights("asew"); + MailboxACL.Rfc4314Rights removedRights = new MailboxACL.Rfc4314Rights("se"); + MailboxACL.Rfc4314Rights finalRights = new MailboxACL.Rfc4314Rights("aw"); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, + new MailboxACL.ACLCommand(key, MailboxACL.EditMode.REPLACE, rights)); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, + new MailboxACL.ACLCommand(key, MailboxACL.EditMode.REMOVE, removedRights)); @@ -226,16 +225,16 @@ public abstract class MailboxMapperACLTest { @Test public void removeAclShouldNotFailWhenRemovingNonExistingRight() throws MailboxException { - SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE); - SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew"); - SimpleMailboxACL.Rfc4314Rights removedRights = new SimpleMailboxACL.Rfc4314Rights("sel"); - SimpleMailboxACL.Rfc4314Rights finalRights = new SimpleMailboxACL.Rfc4314Rights("aw"); + MailboxACL.EntryKey key = new MailboxACL.EntryKey("user", MailboxACL.NameType.user, NEGATIVE); + MailboxACL.Rfc4314Rights rights = new MailboxACL.Rfc4314Rights("asew"); + MailboxACL.Rfc4314Rights removedRights = new MailboxACL.Rfc4314Rights("sel"); + MailboxACL.Rfc4314Rights finalRights = new MailboxACL.Rfc4314Rights("aw"); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, + new MailboxACL.ACLCommand(key, MailboxACL.EditMode.REPLACE, rights)); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, + new MailboxACL.ACLCommand(key, MailboxACL.EditMode.REMOVE, removedRights)); @@ -249,15 +248,15 @@ public abstract class MailboxMapperACLTest { @Test public void resetAclShouldReplaceStoredAcl() throws MailboxException { - SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE); - SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("asew"); - SimpleMailboxACL.Rfc4314Rights newRights = new SimpleMailboxACL.Rfc4314Rights("skate"); + MailboxACL.EntryKey key = new MailboxACL.EntryKey("user", MailboxACL.NameType.user, NEGATIVE); + MailboxACL.Rfc4314Rights rights = new MailboxACL.Rfc4314Rights("asew"); + MailboxACL.Rfc4314Rights newRights = new MailboxACL.Rfc4314Rights("skate"); mailboxMapper.updateACL(benwaInboxMailbox, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, + new MailboxACL.ACLCommand(key, MailboxACL.EditMode.REPLACE, rights)); mailboxMapper.resetACL(benwaInboxMailbox, - new SimpleMailboxACL(ImmutableMap.of(key, newRights))); + new MailboxACL(ImmutableMap.of(key, newRights))); assertThat( mailboxMapper.findMailboxById(benwaInboxMailbox.getMailboxId()) @@ -269,10 +268,10 @@ public abstract class MailboxMapperACLTest { @Test public void resetAclShouldInitializeStoredAcl() throws MailboxException { - SimpleMailboxACL.SimpleMailboxACLEntryKey key = new SimpleMailboxACL.SimpleMailboxACLEntryKey("user", MailboxACL.NameType.user, NEGATIVE); - SimpleMailboxACL.Rfc4314Rights rights = new SimpleMailboxACL.Rfc4314Rights("skate"); + MailboxACL.EntryKey key = new MailboxACL.EntryKey("user", MailboxACL.NameType.user, NEGATIVE); + MailboxACL.Rfc4314Rights rights = new MailboxACL.Rfc4314Rights("skate"); mailboxMapper.resetACL(benwaInboxMailbox, - new SimpleMailboxACL(ImmutableMap.of(key, rights))); + new MailboxACL(ImmutableMap.of(key, rights))); assertThat( mailboxMapper.findMailboxById(benwaInboxMailbox.getMailboxId()) http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/GrantRightsOnHost.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/GrantRightsOnHost.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/GrantRightsOnHost.java index 417d23b..5ae7b14 100644 --- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/GrantRightsOnHost.java +++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/GrantRightsOnHost.java @@ -24,6 +24,6 @@ import org.apache.james.mailbox.model.MailboxPath; public interface GrantRightsOnHost { - void grantRights(MailboxPath mailboxPath, String userName, MailboxACL.MailboxACLRights rights) throws Exception; + void grantRights(MailboxPath mailboxPath, String userName, MailboxACL.Rfc4314Rights rights) throws Exception; } http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLCommands.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLCommands.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLCommands.java index 5768825..cb414a4 100644 --- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLCommands.java +++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLCommands.java @@ -23,7 +23,6 @@ import java.util.Locale; import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxPath; -import org.apache.james.mailbox.model.SimpleMailboxACL; import org.apache.james.mpt.api.ImapHostSystem; import org.apache.james.mpt.imapmailbox.GrantRightsOnHost; import org.apache.james.mpt.imapmailbox.ImapTestConstants; @@ -43,7 +42,7 @@ public abstract class ACLCommands implements ImapTestConstants { private ImapHostSystem system; private GrantRightsOnHost grantRightsOnHost; - private MailboxACL.MailboxACLRights readWriteSeenRight; + private MailboxACL.Rfc4314Rights readWriteSeenRight; private ACLScriptedTestProtocol scriptedTestProtocol; @Before @@ -54,7 +53,7 @@ public abstract class ACLCommands implements ImapTestConstants { scriptedTestProtocol = new ACLScriptedTestProtocol(grantRightsOnHost, appender, "/org/apache/james/imap/scripts/", system) .withUser(USER, PASSWORD) .withLocale(Locale.US); - readWriteSeenRight = new SimpleMailboxACL.Rfc4314Rights("rsw"); + readWriteSeenRight = new MailboxACL.Rfc4314Rights("rsw"); } @Test http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java index 9a64f5f..4b16d04 100644 --- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java +++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLIntegration.java @@ -21,8 +21,8 @@ package org.apache.james.mpt.imapmailbox.suite; import java.util.Locale; +import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxPath; -import org.apache.james.mailbox.model.SimpleMailboxACL; import org.apache.james.mpt.api.ImapHostSystem; import org.apache.james.mpt.imapmailbox.GrantRightsOnHost; import org.apache.james.mpt.imapmailbox.ImapTestConstants; @@ -60,42 +60,42 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightRShouldBeSufficientToPerformStatusSelectCloseExamineUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("r")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("r")) .run("aclIntegration/ACLIntegrationRightR"); } @Test public void rightRShouldBeNeededToPerformStatusSelectCloseExamineUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("lswipkxtecda")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("lswipkxtecda")) .run("aclIntegration/ACLIntegrationWithoutRightR"); } @Test public void rightLShouldBeSufficientToPerformListUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("l")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("l")) .run("aclIntegration/ACLIntegrationRightL"); } @Test public void rightLShouldBeNeededToPerformListLsubSubscribeUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rswipkxtecda")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rswipkxtecda")) .run("aclIntegration/ACLIntegrationWithoutRightL"); } @Test public void rightAShouldBeSufficientToManageACLUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("a")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("a")) .run("aclIntegration/ACLIntegrationRightA"); } @Test public void rightAShouldBeNeededToManageACLUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rswipkxtecdl")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rswipkxtecdl")) .run("aclIntegration/ACLIntegrationWithoutRightA"); } @@ -103,7 +103,7 @@ public abstract class ACLIntegration implements ImapTestConstants { public void rightXOnOriginShouldBeSufficientToRenameAMailboxUS() throws Exception { scriptedTestProtocol .withMailbox(new MailboxPath("#private","Boby","test")) - .withGrantRights(new MailboxPath("#private", OTHER_USER_NAME, "test"), USER, new SimpleMailboxACL.Rfc4314Rights("x")) + .withGrantRights(new MailboxPath("#private", OTHER_USER_NAME, "test"), USER, new MailboxACL.Rfc4314Rights("x")) .run("aclIntegration/ACLIntegrationRightX"); } @@ -111,7 +111,7 @@ public abstract class ACLIntegration implements ImapTestConstants { public void rightXOnOriginShouldBeNeededToRenameAMailboxUS() throws Exception { scriptedTestProtocol .withMailbox(new MailboxPath("#private","Boby","test")) - .withGrantRights(new MailboxPath("#private", OTHER_USER_NAME, "test"), USER, new SimpleMailboxACL.Rfc4314Rights("rswipktela")) + .withGrantRights(new MailboxPath("#private", OTHER_USER_NAME, "test"), USER, new MailboxACL.Rfc4314Rights("rswipktela")) .run("aclIntegration/ACLIntegrationWithoutRightX"); } @@ -120,8 +120,8 @@ public abstract class ACLIntegration implements ImapTestConstants { MailboxPath newMailbox = new MailboxPath("#private", USER, "test"); scriptedTestProtocol .withMailbox(newMailbox) - .withGrantRights(newMailbox, USER, new SimpleMailboxACL.Rfc4314Rights("x")) - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("k")) + .withGrantRights(newMailbox, USER, new MailboxACL.Rfc4314Rights("x")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("k")) .run("aclIntegration/ACLIntegrationRightK"); } @@ -130,64 +130,64 @@ public abstract class ACLIntegration implements ImapTestConstants { MailboxPath newMailbox = new MailboxPath("#private", USER, "test"); scriptedTestProtocol .withMailbox(newMailbox) - .withGrantRights(newMailbox, USER, new SimpleMailboxACL.Rfc4314Rights("x")) - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rswipxtela")) + .withGrantRights(newMailbox, USER, new MailboxACL.Rfc4314Rights("x")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rswipxtela")) .run("aclIntegration/ACLIntegrationWithoutRightK"); } @Test public void rightREShouldBeSufficientToPerformExpungeUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("re")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("re")) .run("aclIntegration/ACLIntegrationRightRE"); } @Test public void rightEShouldBeNeededToPerformExpungeUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rswipxtclak")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rswipxtclak")) .run("aclIntegration/ACLIntegrationWithoutRightE"); } @Test public void rightIShouldBeSufficientToPerformAppendUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("ri")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("ri")) .run("aclIntegration/ACLIntegrationRightI"); } @Test public void rightIShouldBeNeededToPerformAppendUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rswepxtcdlak")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rswepxtcdlak")) .run("aclIntegration/ACLIntegrationWithoutRightI"); } @Test public void rightISShouldBeSufficientToPerformAppendOfSeenMessageUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("ris")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("ris")) .run("aclIntegration/ACLIntegrationRightIS"); } @Test public void rightITShouldBeSufficientToPerformAppendOfDeletedMessageUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rit")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rit")) .run("aclIntegration/ACLIntegrationRightIT"); } @Test public void rightIWShouldBeSufficientToPerformAppendOfDeletedMessageUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("riw")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("riw")) .run("aclIntegration/ACLIntegrationRightIW"); } @Test public void rightRSShouldBeSufficientToPerformStoreAndFetchOnSeenMessageUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rs")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rs")) .withFilledMailbox(OTHER_USER_MAILBOX) .run("aclIntegration/ACLIntegrationRightRS"); } @@ -195,7 +195,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightSShouldBeNeededToPerformStoreAndFetchOnSeenMessageUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rwipxtcdlake")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rwipxtcdlake")) .withFilledMailbox(OTHER_USER_MAILBOX) .run("aclIntegration/ACLIntegrationWithoutRightS"); } @@ -203,7 +203,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightRWShouldBeSufficientToPerformStoreOnFlaggedMessageUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rw")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rw")) .withFilledMailbox(OTHER_USER_MAILBOX) .run("aclIntegration/ACLIntegrationRightRW"); } @@ -211,7 +211,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightWShouldBeNeededToPerformStoreOnFlaggedMessageUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rsipxtcdlake")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rsipxtcdlake")) .withFilledMailbox(OTHER_USER_MAILBOX) .run("aclIntegration/ACLIntegrationWithoutRightW"); } @@ -219,7 +219,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightRTShouldBeSufficientToPerformStoreOnDeletedMessageUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rt")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rt")) .withFilledMailbox(OTHER_USER_MAILBOX) .run("aclIntegration/ACLIntegrationRightRT"); } @@ -227,7 +227,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightTShouldBeNeededToPerformStoreOnFlaggedMessageUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rwipxslake")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rwipxslake")) .withFilledMailbox(OTHER_USER_MAILBOX) .run("aclIntegration/ACLIntegrationWithoutRightT"); } @@ -235,7 +235,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightIShouldBeSufficientToPerformCopyUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("i")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("i")) .withFilledMailbox(MY_INBOX) .run("aclIntegration/ACLIntegrationCopyI"); } @@ -243,7 +243,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightIShouldBeNeededToPerformCopyUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rswpxtcdlake")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rswpxtcdlake")) .withFilledMailbox(MY_INBOX) .run("aclIntegration/ACLIntegrationCopyWithoutI"); } @@ -251,7 +251,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightIShouldBeSufficientToPerformOfSeenMessagesCopyUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("ris")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("ris")) .withFilledMailbox(MY_INBOX) .run("aclIntegration/ACLIntegrationCopyIS"); } @@ -259,7 +259,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightSShouldBeNeededToPerformCopyOfSeenMessageUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("riwpxtcdlake")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("riwpxtcdlake")) .withFilledMailbox(MY_INBOX) .run("aclIntegration/ACLIntegrationCopyWithoutS"); } @@ -267,7 +267,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightIWShouldBeSufficientToPerformOfFlaggedMessagesCopyUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("riw")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("riw")) .withFilledMailbox(MY_INBOX) .run("aclIntegration/ACLIntegrationCopyIW"); } @@ -275,7 +275,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightWShouldBeNeededToPerformCopyOfFlaggedMessageUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rispxtcdlake")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rispxtcdlake")) .withFilledMailbox(MY_INBOX) .run("aclIntegration/ACLIntegrationCopyWithoutW"); } @@ -283,7 +283,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightITShouldBeSufficientToPerformOfDeletedMessagesCopyUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rit")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rit")) .withFilledMailbox(MY_INBOX) .run("aclIntegration/ACLIntegrationCopyIT"); } @@ -291,7 +291,7 @@ public abstract class ACLIntegration implements ImapTestConstants { @Test public void rightTShouldBeNeededToPerformCopyOfDeletedMessageUS() throws Exception { scriptedTestProtocol - .withGrantRights(OTHER_USER_MAILBOX, USER, new SimpleMailboxACL.Rfc4314Rights("rispxwlake")) + .withGrantRights(OTHER_USER_MAILBOX, USER, new MailboxACL.Rfc4314Rights("rispxwlake")) .withFilledMailbox(MY_INBOX) .run("aclIntegration/ACLIntegrationCopyWithoutT"); } http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLScriptedTestProtocol.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLScriptedTestProtocol.java b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLScriptedTestProtocol.java index 0f4bd13..137cecf 100644 --- a/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLScriptedTestProtocol.java +++ b/mpt/impl/imap-mailbox/core/src/main/java/org/apache/james/mpt/imapmailbox/suite/ACLScriptedTestProtocol.java @@ -3,7 +3,6 @@ package org.apache.james.mpt.imapmailbox.suite; import java.util.Locale; import org.apache.james.mailbox.model.MailboxACL; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights; import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mpt.api.HostSystem; import org.apache.james.mpt.api.ImapHostSystem; @@ -18,9 +17,9 @@ public class ACLScriptedTestProtocol extends ImapScriptedTestProtocol { GrantRightsOnHost grantRightsOnHost; MailboxPath mailboxPath; String userName; - MailboxACL.MailboxACLRights rights; + MailboxACL.Rfc4314Rights rights; - GrantRightsCommand(GrantRightsOnHost grantRightsOnHost, MailboxPath mailboxPath, String userName, MailboxACLRights rights) { + GrantRightsCommand(GrantRightsOnHost grantRightsOnHost, MailboxPath mailboxPath, String userName, MailboxACL.Rfc4314Rights rights) { this.grantRightsOnHost = grantRightsOnHost; this.mailboxPath = mailboxPath; this.userName = userName; @@ -57,7 +56,7 @@ public class ACLScriptedTestProtocol extends ImapScriptedTestProtocol { this.mailboxMessageAppender = mailboxMessageAppender; } - public ACLScriptedTestProtocol withGrantRights(MailboxPath mailboxPath, String userName, MailboxACL.MailboxACLRights rights) { + public ACLScriptedTestProtocol withGrantRights(MailboxPath mailboxPath, String userName, MailboxACL.Rfc4314Rights rights) { return (ACLScriptedTestProtocol) withPreparedCommand(new GrantRightsCommand(grantRightsOnHost, mailboxPath, userName, rights)); } http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/GrantRightsOnCyrusHost.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/GrantRightsOnCyrusHost.java b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/GrantRightsOnCyrusHost.java index b424b60..da23f6d 100644 --- a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/GrantRightsOnCyrusHost.java +++ b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/GrantRightsOnCyrusHost.java @@ -19,12 +19,13 @@ package org.apache.james.mpt.imapmailbox.cyrus.host; -import com.google.inject.Inject; import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mpt.imapmailbox.GrantRightsOnHost; import org.apache.james.mpt.protocol.ProtocolSession; +import com.google.inject.Inject; + public class GrantRightsOnCyrusHost implements GrantRightsOnHost { private static final String GRANT_RIGHTS_LOCATION = "ACLCommands.grantRights"; @@ -35,7 +36,7 @@ public class GrantRightsOnCyrusHost implements GrantRightsOnHost { this.system = system; } - public void grantRights(MailboxPath mailboxPath, String userName, MailboxACL.MailboxACLRights rights) throws Exception { + public void grantRights(MailboxPath mailboxPath, String userName, MailboxACL.Rfc4314Rights rights) throws Exception { ProtocolSession protocolSession = system.logAndGetAdminProtocolSession(new ProtocolSession()); protocolSession.CL(String.format("A1 SETACL %s %s %s", system.createMailboxStringFromMailboxPath(mailboxPath), http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/encode/ACLResponseEncoder.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/encode/ACLResponseEncoder.java b/protocols/imap/src/main/java/org/apache/james/imap/encode/ACLResponseEncoder.java index 4403142..f5aa148 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/encode/ACLResponseEncoder.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/encode/ACLResponseEncoder.java @@ -28,8 +28,8 @@ import org.apache.james.imap.api.ImapMessage; import org.apache.james.imap.api.process.ImapSession; import org.apache.james.imap.encode.base.AbstractChainedImapEncoder; import org.apache.james.imap.message.response.ACLResponse; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLEntryKey; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights; +import org.apache.james.mailbox.model.MailboxACL.EntryKey; +import org.apache.james.mailbox.model.MailboxACL.Rfc4314Rights; /** * ACL Response Encoder. @@ -52,7 +52,7 @@ public class ACLResponseEncoder extends AbstractChainedImapEncoder { */ protected void doEncode(ImapMessage acceptableMessage, ImapResponseComposer composer, ImapSession session) throws IOException { final ACLResponse aclResponse = (ACLResponse) acceptableMessage; - final Map<MailboxACLEntryKey, MailboxACLRights> entries = aclResponse.getAcl().getEntries(); + final Map<EntryKey, Rfc4314Rights> entries = aclResponse.getAcl().getEntries(); composer.untagged(); composer.commandName(ImapConstants.ACL_RESPONSE_NAME); @@ -60,7 +60,7 @@ public class ACLResponseEncoder extends AbstractChainedImapEncoder { composer.mailbox(mailboxName == null ? "" : mailboxName); if (entries != null) { - for (Entry<MailboxACLEntryKey, MailboxACLRights> entry : entries.entrySet()) { + for (Entry<EntryKey, Rfc4314Rights> entry : entries.entrySet()) { String identifier = entry.getKey().serialize(); composer.quote(identifier); String rights = entry.getValue().serialize(); http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/encode/ListRightsResponseEncoder.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/encode/ListRightsResponseEncoder.java b/protocols/imap/src/main/java/org/apache/james/imap/encode/ListRightsResponseEncoder.java index 0ceff71..96766b4 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/encode/ListRightsResponseEncoder.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/encode/ListRightsResponseEncoder.java @@ -26,7 +26,7 @@ import org.apache.james.imap.api.ImapMessage; import org.apache.james.imap.api.process.ImapSession; import org.apache.james.imap.encode.base.AbstractChainedImapEncoder; import org.apache.james.imap.message.response.ListRightsResponse; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights; +import org.apache.james.mailbox.model.MailboxACL.Rfc4314Rights; /** * ACL Response Encoder. @@ -57,9 +57,9 @@ public class ListRightsResponseEncoder extends AbstractChainedImapEncoder { String identifier = listRightsResponse.getIdentifier(); composer.quote(identifier); - MailboxACLRights[] rights = listRightsResponse.getRights(); + Rfc4314Rights[] rights = listRightsResponse.getRights(); - for (MailboxACLRights entry : rights) { + for (Rfc4314Rights entry : rights) { composer.quote(entry.serialize()); } composer.end(); http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/encode/MyRightsResponseEncoder.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/encode/MyRightsResponseEncoder.java b/protocols/imap/src/main/java/org/apache/james/imap/encode/MyRightsResponseEncoder.java index 9ce99f1..a70b2d4 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/encode/MyRightsResponseEncoder.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/encode/MyRightsResponseEncoder.java @@ -26,7 +26,7 @@ import org.apache.james.imap.api.ImapMessage; import org.apache.james.imap.api.process.ImapSession; import org.apache.james.imap.encode.base.AbstractChainedImapEncoder; import org.apache.james.imap.message.response.MyRightsResponse; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights; +import org.apache.james.mailbox.model.MailboxACL.Rfc4314Rights; /** * MYRIGHTS Response Encoder. @@ -48,7 +48,7 @@ public class MyRightsResponseEncoder extends AbstractChainedImapEncoder { */ protected void doEncode(ImapMessage acceptableMessage, ImapResponseComposer composer, ImapSession session) throws IOException { final MyRightsResponse aclResponse = (MyRightsResponse) acceptableMessage; - final MailboxACLRights myRights = aclResponse.getMyRights(); + final Rfc4314Rights myRights = aclResponse.getMyRights(); composer.untagged(); composer.commandName(ImapConstants.MYRIGHTS_RESPONSE_NAME); http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/message/response/ACLResponse.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/message/response/ACLResponse.java b/protocols/imap/src/main/java/org/apache/james/imap/message/response/ACLResponse.java index a6fdbd0..a1a5dd1 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/message/response/ACLResponse.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/message/response/ACLResponse.java @@ -24,8 +24,8 @@ import java.util.Map.Entry; import org.apache.james.imap.api.ImapConstants; import org.apache.james.imap.api.message.response.ImapResponseMessage; import org.apache.james.mailbox.model.MailboxACL; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLEntryKey; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights; +import org.apache.james.mailbox.model.MailboxACL.EntryKey; +import org.apache.james.mailbox.model.MailboxACL.Rfc4314Rights; /** * ACL Response. @@ -74,13 +74,11 @@ public final class ACLResponse implements ImapResponseMessage { .append(' ') .append(mailboxName); - for (Entry<MailboxACLEntryKey, MailboxACLRights> en : acl.getEntries().entrySet()) { - result - .append(' ') - .append(en.getKey().toString()) - .append(' ') - .append(en.getValue().toString()) - ; + for (Entry<EntryKey, Rfc4314Rights> en : acl.getEntries().entrySet()) { + result.append(' ') + .append(en.getKey().toString()) + .append(' ') + .append(en.getValue().toString()); } return result.toString(); http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/message/response/ListRightsResponse.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/message/response/ListRightsResponse.java b/protocols/imap/src/main/java/org/apache/james/imap/message/response/ListRightsResponse.java index 4c77439..2e215c7 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/message/response/ListRightsResponse.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/message/response/ListRightsResponse.java @@ -23,7 +23,7 @@ import java.util.Arrays; import org.apache.james.imap.api.ImapConstants; import org.apache.james.imap.api.message.response.ImapResponseMessage; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights; +import org.apache.james.mailbox.model.MailboxACL; /** * LISTRIGHTS Response. @@ -34,9 +34,9 @@ public final class ListRightsResponse implements ImapResponseMessage { private final String identifier; private final String mailboxName; - private final MailboxACLRights[] rights; + private final MailboxACL.Rfc4314Rights[] rights; - public ListRightsResponse(String mailboxName, String identifier, MailboxACLRights[] rights) { + public ListRightsResponse(String mailboxName, String identifier, MailboxACL.Rfc4314Rights[] rights) { super(); this.mailboxName = mailboxName; this.identifier = identifier; @@ -60,7 +60,7 @@ public final class ListRightsResponse implements ImapResponseMessage { return mailboxName; } - public MailboxACLRights[] getRights() { + public MailboxACL.Rfc4314Rights[] getRights() { return rights; } @@ -78,7 +78,7 @@ public final class ListRightsResponse implements ImapResponseMessage { public String toString() { StringBuilder result = new StringBuilder().append(ImapConstants.LISTRIGHTS_RESPONSE_NAME).append(' ').append(mailboxName).append(' ').append(identifier); - for (MailboxACLRights optionalRightsGroup : rights) { + for (MailboxACL.Rfc4314Rights optionalRightsGroup : rights) { result.append(' ').append(optionalRightsGroup.toString()); } http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/message/response/MyRightsResponse.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/message/response/MyRightsResponse.java b/protocols/imap/src/main/java/org/apache/james/imap/message/response/MyRightsResponse.java index e02199b..2a04d69 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/message/response/MyRightsResponse.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/message/response/MyRightsResponse.java @@ -21,7 +21,7 @@ package org.apache.james.imap.message.response; import org.apache.james.imap.api.ImapConstants; import org.apache.james.imap.api.message.response.ImapResponseMessage; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights; +import org.apache.james.mailbox.model.MailboxACL; /** * MYRIGHTS Response. @@ -30,9 +30,9 @@ import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights; */ public final class MyRightsResponse implements ImapResponseMessage { private final String mailboxName; - private final MailboxACLRights myRights; + private final MailboxACL.Rfc4314Rights myRights; - public MyRightsResponse(String mailboxName, MailboxACLRights myRights) { + public MyRightsResponse(String mailboxName, MailboxACL.Rfc4314Rights myRights) { super(); this.mailboxName = mailboxName; this.myRights = myRights; @@ -53,7 +53,7 @@ public final class MyRightsResponse implements ImapResponseMessage { return mailboxName; } - public MailboxACLRights getMyRights() { + public MailboxACL.Rfc4314Rights getMyRights() { return myRights; } http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java index 253d48c..358d680 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/DeleteACLProcessor.java @@ -37,11 +37,10 @@ import org.apache.james.mailbox.MailboxSession; import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.exception.MailboxNotFoundException; import org.apache.james.mailbox.exception.UnsupportedRightException; +import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxACL.EditMode; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLEntryKey; +import org.apache.james.mailbox.model.MailboxACL.EntryKey; import org.apache.james.mailbox.model.MailboxPath; -import org.apache.james.mailbox.model.SimpleMailboxACL; -import org.apache.james.mailbox.model.SimpleMailboxACL.SimpleMailboxACLEntryKey; import org.apache.james.metrics.api.MetricFactory; import org.apache.james.util.MDCBuilder; import org.slf4j.Logger; @@ -86,13 +85,13 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques * would be used if the mailbox did not exist, thus revealing no * existence information, much less the mailboxâs ACL. */ - if (!mailboxManager.hasRight(mailboxPath, SimpleMailboxACL.Right.Lookup, mailboxSession)) { + if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Lookup, mailboxSession)) { no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND); } /* RFC 4314 section 4. */ - else if (!mailboxManager.hasRight(mailboxPath, SimpleMailboxACL.Right.Administer, mailboxSession)) { + else if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Administer, mailboxSession)) { Object[] params = new Object[] { - SimpleMailboxACL.Right.Administer.toString(), + MailboxACL.Right.Administer.toString(), command.getName(), mailboxName }; @@ -101,7 +100,7 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques } else { - MailboxACLEntryKey key = SimpleMailboxACLEntryKey.deserialize(identifier); + EntryKey key = EntryKey.deserialize(identifier); // FIXME check if identifier is a valid user or group // FIXME Servers, when processing a command that has an identifier as a @@ -114,7 +113,7 @@ public class DeleteACLProcessor extends AbstractMailboxProcessor<DeleteACLReques // steps. mailboxManager.setRights(mailboxPath, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, EditMode.REPLACE, null), mailboxSession); + new MailboxACL.ACLCommand(key, EditMode.REPLACE, null), mailboxSession); okComplete(command, tag, responder); // FIXME should we send unsolicited responses here? http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java index 25d3ea0..d4ccfe0 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetACLProcessor.java @@ -39,8 +39,8 @@ import org.apache.james.mailbox.MessageManager.MetaData; import org.apache.james.mailbox.MessageManager.MetaData.FetchGroup; import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.exception.MailboxNotFoundException; +import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxPath; -import org.apache.james.mailbox.model.SimpleMailboxACL; import org.apache.james.metrics.api.MetricFactory; import org.apache.james.util.MDCBuilder; import org.slf4j.Logger; @@ -83,13 +83,13 @@ public class GetACLProcessor extends AbstractMailboxProcessor<GetACLRequest> imp * would be used if the mailbox did not exist, thus revealing no * existence information, much less the mailboxâs ACL. */ - if (!mailboxManager.hasRight(mailboxPath, SimpleMailboxACL.Right.Lookup, mailboxSession)) { + if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Lookup, mailboxSession)) { no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND); } /* RFC 4314 section 4. */ - else if (!mailboxManager.hasRight(mailboxPath, SimpleMailboxACL.Right.Administer, mailboxSession)) { + else if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Administer, mailboxSession)) { Object[] params = new Object[] { - SimpleMailboxACL.Right.Administer.toString(), + MailboxACL.Right.Administer.toString(), command.getName(), mailboxName }; http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java index ab3861e..5553755 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaProcessor.java @@ -34,10 +34,10 @@ import org.apache.james.imap.message.response.QuotaResponse; import org.apache.james.mailbox.MailboxManager; import org.apache.james.mailbox.MailboxSession; import org.apache.james.mailbox.exception.MailboxException; +import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.model.Quota; import org.apache.james.mailbox.model.QuotaRoot; -import org.apache.james.mailbox.model.SimpleMailboxACL; import org.apache.james.mailbox.quota.QuotaManager; import org.apache.james.mailbox.quota.QuotaRootResolver; import org.apache.james.metrics.api.MetricFactory; @@ -84,7 +84,7 @@ public class GetQuotaProcessor extends AbstractMailboxProcessor<GetQuotaRequest> okComplete(command, tag, responder); } else { Object[] params = new Object[]{ - SimpleMailboxACL.Right.Read.toString(), + MailboxACL.Right.Read.toString(), command.getName(), "Any mailbox of this user USER" }; @@ -101,7 +101,7 @@ public class GetQuotaProcessor extends AbstractMailboxProcessor<GetQuotaRequest> final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session); List<MailboxPath> mailboxList = quotaRootResolver.retrieveAssociatedMailboxes(quotaRootResolver.createQuotaRoot(quotaRoot), mailboxSession); for(MailboxPath mailboxPath : mailboxList) { - if(getMailboxManager().hasRight(mailboxPath, SimpleMailboxACL.Right.Read, mailboxSession)) { + if(getMailboxManager().hasRight(mailboxPath, MailboxACL.Right.Read, mailboxSession)) { return true; } } http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java index 6504e52..27f06d5 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/GetQuotaRootProcessor.java @@ -36,10 +36,10 @@ import org.apache.james.imap.message.response.QuotaRootResponse; import org.apache.james.mailbox.MailboxManager; import org.apache.james.mailbox.MailboxSession; import org.apache.james.mailbox.exception.MailboxException; +import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.model.Quota; import org.apache.james.mailbox.model.QuotaRoot; -import org.apache.james.mailbox.model.SimpleMailboxACL; import org.apache.james.mailbox.quota.QuotaManager; import org.apache.james.mailbox.quota.QuotaRootResolver; import org.apache.james.metrics.api.MetricFactory; @@ -76,7 +76,7 @@ public class GetQuotaRootProcessor extends AbstractMailboxProcessor<GetQuotaRoot // First check mailbox exists try { - if (mailboxManager.hasRight(mailboxPath, SimpleMailboxACL.Right.Read, mailboxSession)) { + if (mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Read, mailboxSession)) { QuotaRoot quotaRoot = quotaRootResolver.getQuotaRoot(mailboxPath); Quota messageQuota = quotaManager.getMessageQuota(quotaRoot); // See RFC 2087 : response for STORAGE should be in KB. For more accuracy, we stores B, so conversion should be made @@ -87,7 +87,7 @@ public class GetQuotaRootProcessor extends AbstractMailboxProcessor<GetQuotaRoot okComplete(command, tag, responder); } else { Object[] params = new Object[]{ - SimpleMailboxACL.Right.Read.toString(), + MailboxACL.Right.Read.toString(), command.getName(), message.getMailboxName() }; http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java index fea89fe..e6e8a12 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/ListRightsProcessor.java @@ -36,11 +36,10 @@ import org.apache.james.mailbox.MailboxManager; import org.apache.james.mailbox.MailboxSession; import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.exception.MailboxNotFoundException; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLEntryKey; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights; +import org.apache.james.mailbox.model.MailboxACL; +import org.apache.james.mailbox.model.MailboxACL.EntryKey; +import org.apache.james.mailbox.model.MailboxACL.Rfc4314Rights; import org.apache.james.mailbox.model.MailboxPath; -import org.apache.james.mailbox.model.SimpleMailboxACL; -import org.apache.james.mailbox.model.SimpleMailboxACL.SimpleMailboxACLEntryKey; import org.apache.james.metrics.api.MetricFactory; import org.apache.james.util.MDCBuilder; import org.slf4j.Logger; @@ -86,13 +85,13 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ * would be used if the mailbox did not exist, thus revealing no * existence information, much less the mailboxâs ACL. */ - if (!mailboxManager.hasRight(mailboxPath, SimpleMailboxACL.Right.Lookup, mailboxSession)) { + if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Lookup, mailboxSession)) { no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND); } /* RFC 4314 section 4. */ - else if (!mailboxManager.hasRight(mailboxPath, SimpleMailboxACL.Right.Administer, mailboxSession)) { + else if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Administer, mailboxSession)) { Object[] params = new Object[] { - SimpleMailboxACL.Right.Administer.toString(), + MailboxACL.Right.Administer.toString(), command.getName(), mailboxName }; @@ -101,7 +100,7 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ } else { - MailboxACLEntryKey key = SimpleMailboxACLEntryKey.deserialize(identifier); + EntryKey key = EntryKey.deserialize(identifier); // FIXME check if identifier is a valid user or group // FIXME Servers, when processing a command that has an identifier as a @@ -113,7 +112,7 @@ public class ListRightsProcessor extends AbstractMailboxProcessor<ListRightsRequ // Note that Section 6 recommends additional identifierâs verification // steps. - MailboxACLRights[] rights = mailboxManager.listRigths(mailboxPath, key, mailboxSession); + Rfc4314Rights[] rights = mailboxManager.listRigths(mailboxPath, key, mailboxSession); ListRightsResponse aclResponse = new ListRightsResponse(mailboxName, identifier, rights); responder.respond(aclResponse); okComplete(command, tag, responder); http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java index 1c2312e..beda4c1 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/MyRightsProcessor.java @@ -37,9 +37,9 @@ import org.apache.james.mailbox.MailboxManager; import org.apache.james.mailbox.MailboxSession; import org.apache.james.mailbox.exception.MailboxException; import org.apache.james.mailbox.exception.MailboxNotFoundException; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights; +import org.apache.james.mailbox.model.MailboxACL; +import org.apache.james.mailbox.model.MailboxACL.Rfc4314Rights; import org.apache.james.mailbox.model.MailboxPath; -import org.apache.james.mailbox.model.SimpleMailboxACL; import org.apache.james.metrics.api.MetricFactory; import org.apache.james.util.MDCBuilder; import org.slf4j.Logger; @@ -71,7 +71,7 @@ public class MyRightsProcessor extends AbstractMailboxProcessor<MyRightsRequest> MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName); // Check that mailbox exists mailboxManager.getMailbox(mailboxPath, mailboxSession); - MailboxACLRights myRights = mailboxManager.myRights(mailboxPath, mailboxSession); + Rfc4314Rights myRights = mailboxManager.myRights(mailboxPath, mailboxSession); /* * RFC 4314 section 6. An implementation MUST make sure the ACL @@ -86,12 +86,12 @@ public class MyRightsProcessor extends AbstractMailboxProcessor<MyRightsRequest> * RFC 4314 section 4. * MYRIGHTS - any of the following rights is * required to perform the operation: "l", "r", "i", "k", "x", "a". */ - if (!myRights.contains(SimpleMailboxACL.Right.Lookup) - && !myRights.contains(SimpleMailboxACL.Right.Read) - && !myRights.contains(SimpleMailboxACL.Right.Insert) - && !myRights.contains(SimpleMailboxACL.Right.CreateMailbox) - && !myRights.contains(SimpleMailboxACL.Right.DeleteMailbox) - && !myRights.contains(SimpleMailboxACL.Right.Administer)) { + if (!myRights.contains(MailboxACL.Right.Lookup) + && !myRights.contains(MailboxACL.Right.Read) + && !myRights.contains(MailboxACL.Right.Insert) + && !myRights.contains(MailboxACL.Right.CreateMailbox) + && !myRights.contains(MailboxACL.Right.DeleteMailbox) + && !myRights.contains(MailboxACL.Right.Administer)) { no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND); } else { MyRightsResponse myRightsResponse = new MyRightsResponse(mailboxName, myRights); http://git-wip-us.apache.org/repos/asf/james-project/blob/4e10f10b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java index 455a439..5f39de3 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/SetACLProcessor.java @@ -39,12 +39,9 @@ import org.apache.james.mailbox.exception.MailboxNotFoundException; import org.apache.james.mailbox.exception.UnsupportedRightException; import org.apache.james.mailbox.model.MailboxACL; import org.apache.james.mailbox.model.MailboxACL.EditMode; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLEntryKey; -import org.apache.james.mailbox.model.MailboxACL.MailboxACLRights; +import org.apache.james.mailbox.model.MailboxACL.EntryKey; +import org.apache.james.mailbox.model.MailboxACL.Rfc4314Rights; import org.apache.james.mailbox.model.MailboxPath; -import org.apache.james.mailbox.model.SimpleMailboxACL; -import org.apache.james.mailbox.model.SimpleMailboxACL.Rfc4314Rights; -import org.apache.james.mailbox.model.SimpleMailboxACL.SimpleMailboxACLEntryKey; import org.apache.james.metrics.api.MetricFactory; import org.apache.james.util.MDCBuilder; import org.slf4j.Logger; @@ -75,21 +72,21 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp try { /* parsing the rights is the the cheapest thing to begin with */ - EditMode editMode = MailboxACL.EditMode.REPLACE; + EditMode editMode = EditMode.REPLACE; String rights = message.getRights(); if (rights != null && rights.length() > 0) { switch (rights.charAt(0)) { case MailboxACL.ADD_RIGHTS_MARKER: - editMode = MailboxACL.EditMode.ADD; + editMode = EditMode.ADD; rights = rights.substring(1); break; case MailboxACL.REMOVE_RIGHTS_MARKER: - editMode = MailboxACL.EditMode.REMOVE; + editMode = EditMode.REMOVE; rights = rights.substring(1); break; } } - MailboxACLRights mailboxAclRights = new Rfc4314Rights(rights); + Rfc4314Rights mailboxAclRights = new Rfc4314Rights(rights); MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName); // Check that mailbox exists @@ -105,13 +102,13 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp * would be used if the mailbox did not exist, thus revealing no * existence information, much less the mailboxâs ACL. */ - if (!mailboxManager.hasRight(mailboxPath, SimpleMailboxACL.Right.Lookup, mailboxSession)) { + if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Lookup, mailboxSession)) { no(command, tag, responder, HumanReadableText.MAILBOX_NOT_FOUND); } /* RFC 4314 section 4. */ - else if (!mailboxManager.hasRight(mailboxPath, SimpleMailboxACL.Right.Administer, mailboxSession)) { + else if (!mailboxManager.hasRight(mailboxPath, MailboxACL.Right.Administer, mailboxSession)) { Object[] params = new Object[] { - SimpleMailboxACL.Right.Administer.toString(), + MailboxACL.Right.Administer.toString(), command.getName(), mailboxName }; @@ -120,7 +117,7 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp } else { - MailboxACLEntryKey key = SimpleMailboxACLEntryKey.deserialize(identifier); + EntryKey key = EntryKey.deserialize(identifier); // FIXME check if identifier is a valid user or group // FIXME Servers, when processing a command that has an identifier as a @@ -133,7 +130,7 @@ public class SetACLProcessor extends AbstractMailboxProcessor<SetACLRequest> imp // steps. mailboxManager.setRights(mailboxPath, - new SimpleMailboxACL.SimpleMailboxACLCommand(key, editMode, mailboxAclRights), mailboxSession); + new MailboxACL.ACLCommand(key, editMode, mailboxAclRights), mailboxSession); okComplete(command, tag, responder); // FIXME should we send unsolicited responses here? --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org