You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2017/11/03 02:33:22 UTC
[05/15] james-project git commit: MAILBOX-317 MailboxManager rights
API javadoc should reference RightManager
MAILBOX-317 MailboxManager rights API javadoc should reference RightManager
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/0930817c
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/0930817c
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/0930817c
Branch: refs/heads/master
Commit: 0930817cb1ceb561dd7223f2967b3af74119404c
Parents: afbed0f
Author: benwa <bt...@linagora.com>
Authored: Thu Nov 2 13:37:17 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Fri Nov 3 09:32:32 2017 +0700
----------------------------------------------------------------------
.../apache/james/mailbox/MailboxManager.java | 105 +------------------
.../mailbox/store/StoreMailboxManager.java | 5 +
.../base/MailboxEventAnalyserTest.java | 5 +
...ltMailboxesProvisioningFilterThreadTest.java | 5 +
4 files changed, 16 insertions(+), 104 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/0930817c/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxManager.java b/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxManager.java
index 7a55280..67b122d 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxManager.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/MailboxManager.java
@@ -22,17 +22,11 @@ package org.apache.james.mailbox;
import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
-import java.util.Set;
-import org.apache.james.mailbox.exception.AnnotationException;
import org.apache.james.mailbox.exception.BadCredentialsException;
import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.exception.MailboxExistsException;
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.MailboxAnnotation;
-import org.apache.james.mailbox.model.MailboxAnnotationKey;
import org.apache.james.mailbox.model.MailboxId;
import org.apache.james.mailbox.model.MailboxMetaData;
import org.apache.james.mailbox.model.MailboxPath;
@@ -74,7 +68,7 @@ import org.apache.james.mailbox.model.search.MailboxQuery;
* </p>
*/
-public interface MailboxManager extends RequestAware, MailboxListenerSupport {
+public interface MailboxManager extends RequestAware, MailboxListenerSupport, RightManager, MailboxAnnotationManager {
enum MailboxCapabilities {
Annotation,
@@ -337,78 +331,6 @@ public interface MailboxManager extends RequestAware, MailboxListenerSupport {
void logout(MailboxSession session, boolean force) throws MailboxException;
/**
- * Tells whether the given {@link MailboxSession}'s user has the given
- * {@link MailboxACL.MailboxACLRight} for this {@link MessageManager}'s mailbox.
- *
- * @param session MailboxSession of the user we want to check
- * @param right Right we want to check.
- * @param session Session of the user we want to check this right against.
- * @return true if the given {@link MailboxSession}'s user has the given
- * {@link MailboxACL.MailboxACLRight} for this {@link MessageManager}'s
- * mailbox; false otherwise.
- * @throws MailboxException
- */
- boolean hasRight(MailboxPath mailboxPath, MailboxACL.Right right, MailboxSession session) throws MailboxException;
-
- /**
- * Returns the rights applicable to the user who has sent the current
- * request on the mailbox designated by this mailboxPath.
- *
- * @param mailboxPath Path of the mailbox you want to get your rights on.
- * @param session The session used to determine the user we should retrieve the rights of.
- * @return the rights applicable to the user who has sent the request,
- * returns {@link MailboxACL#NO_RIGHTS} if
- * {@code session.getUser()} is null.
- * @throws UnsupportedRightException
- */
- MailboxACL.Rfc4314Rights myRights(MailboxPath mailboxPath, MailboxSession session) throws MailboxException;
-
- MailboxACL.Rfc4314Rights myRights(MailboxId mailboxId, MailboxSession session) throws MailboxException;
-
- /**
- * Computes a result suitable for the LISTRIGHTS IMAP command. The result is
- * computed for this mailbox and the given {@code identifier}.
- *
- * From RFC 4314 section 3.7:
- * The first element of the resulting array contains the (possibly empty)
- * set of rights the identifier will always be granted in the mailbox.
- * Following this are zero or more right sets the identifier can be granted
- * in the mailbox. Rights mentioned in the same set are tied together. The
- * server MUST either grant all tied rights to the identifier in the mailbox
- * or grant none.
- *
- * The same right MUST NOT be listed more than once in the LISTRIGHTS
- * command.
- *
- * @param mailboxPath Path of the mailbox you want to get the rights list.
- * @param identifier
- * the identifier from the LISTRIGHTS command.
- * @param session Right of the user performing the request.
- * @return result suitable for the LISTRIGHTS IMAP command
- * @throws UnsupportedRightException
- */
- MailboxACL.Rfc4314Rights[] listRigths(MailboxPath mailboxPath, MailboxACL.EntryKey identifier, MailboxSession session) throws MailboxException;
-
- /**
- * Update the Mailbox ACL of the designated mailbox. We can either ADD REPLACE or REMOVE entries.
- *
- * @param mailboxACLCommand Update to perform.
- * @throws UnsupportedRightException
- */
- void applyRightsCommand(MailboxPath mailboxPath, MailboxACL.ACLCommand mailboxACLCommand, MailboxSession session) throws MailboxException;
-
-
- /**
- * Reset the Mailbox ACL of the designated mailbox.
- *
- * @param mailboxACL New ACL value
- * @throws UnsupportedRightException
- */
- void setRights(MailboxPath mailboxPath, MailboxACL mailboxACL, MailboxSession session) throws MailboxException;
-
- void setRights(MailboxId mailboxId, MailboxACL mailboxACL, MailboxSession session) throws MailboxException;
-
- /**
* Return a unmodifiable {@link List} of {@link MailboxPath} objects
*
* @param session
@@ -417,30 +339,5 @@ public interface MailboxManager extends RequestAware, MailboxListenerSupport {
*/
List<MailboxPath> list(MailboxSession session) throws MailboxException;
- /**
- * See {@link MailboxAnnotationManager#getAllAnnotations(MailboxPath, MailboxSession)}
- */
- List<MailboxAnnotation> getAllAnnotations(MailboxPath mailboxPath, MailboxSession session) throws MailboxException;
-
- /**
- * See {@link MailboxAnnotationManager#getAnnotationsByKeys(MailboxPath, MailboxSession, Set)}
- */
- List<MailboxAnnotation> getAnnotationsByKeys(MailboxPath mailboxPath, MailboxSession session, Set<MailboxAnnotationKey> keys) throws MailboxException;
-
- /**
- * See {@link MailboxAnnotationManager#getAnnotationsByKeysWithOneDepth(MailboxPath, MailboxSession, Set)}
- */
- List<MailboxAnnotation> getAnnotationsByKeysWithOneDepth(MailboxPath mailboxPath, MailboxSession session, Set<MailboxAnnotationKey> keys) throws MailboxException;
-
- /**
- * See {@link MailboxAnnotationManager#getAnnotationsByKeysWithAllDepth(MailboxPath, MailboxSession, Set)}
- */
- List<MailboxAnnotation> getAnnotationsByKeysWithAllDepth(MailboxPath mailboxPath, MailboxSession session, Set<MailboxAnnotationKey> keys) throws MailboxException;
-
- /**
- * See {@link MailboxAnnotationManager#updateAnnotations(MailboxPath, MailboxSession, List)}
- */
- void updateAnnotations(MailboxPath mailboxPath, MailboxSession session, List<MailboxAnnotation> mailboxAnnotations) throws MailboxException, AnnotationException;
-
boolean hasChildren(MailboxPath mailboxPath, MailboxSession session) throws MailboxException;
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/0930817c/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
index c53da61..3cd66b0 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
@@ -776,6 +776,11 @@ public class StoreMailboxManager implements MailboxManager {
}
@Override
+ public boolean hasRight(MailboxId mailboxId, Right right, MailboxSession session) throws MailboxException {
+ return storeRightManager.hasRight(mailboxId, right, session);
+ }
+
+ @Override
public Rfc4314Rights myRights(MailboxPath mailboxPath, MailboxSession session) throws MailboxException {
return storeRightManager.myRights(mailboxPath, session);
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/0930817c/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
----------------------------------------------------------------------
diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java b/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
index 091b5e2..45e670b 100644
--- a/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
+++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/base/MailboxEventAnalyserTest.java
@@ -91,6 +91,11 @@ public class MailboxEventAnalyserTest {
private final MailboxManager mockManager = new MailboxManager() {
@Override
+ public boolean hasRight(MailboxId mailboxId, Right right, MailboxSession session) throws MailboxException {
+ return false;
+ }
+
+ @Override
public EnumSet<MailboxCapabilities> getSupportedMailboxCapabilities() {
return EnumSet.noneOf(MailboxCapabilities.class);
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/0930817c/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterThreadTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterThreadTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterThreadTest.java
index 06e9df3..69bfa0f 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterThreadTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/DefaultMailboxesProvisioningFilterThreadTest.java
@@ -190,6 +190,11 @@ public class DefaultMailboxesProvisioningFilterThreadTest {
}
@Override
+ public boolean hasRight(MailboxId mailboxId, MailboxACL.Right right, MailboxSession session) throws MailboxException {
+ return false;
+ }
+
+ @Override
public boolean hasRight(MailboxPath mailboxPath, MailboxACL.Right right, MailboxSession session) throws MailboxException {
return false;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org