james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [10/11] james-project git commit: MAILBOX-316 create MailboxACL RightsManager.listRights() method
Date Wed, 15 Nov 2017 08:02:08 GMT
MAILBOX-316 create MailboxACL RightsManager.listRights() method


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/21e7ff9e
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/21e7ff9e
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/21e7ff9e

Branch: refs/heads/master
Commit: 21e7ff9e046604ae70d0fe2f102c391b874edd8d
Parents: 93ad42b
Author: Matthieu Baechler <matthieu@apache.org>
Authored: Mon Nov 13 16:43:57 2017 +0100
Committer: quynhn <qnguyen@linagora.com>
Committed: Wed Nov 15 09:37:39 2017 +0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/james/mailbox/RightManager.java  | 3 +++
 .../org/apache/james/mailbox/store/StoreMailboxManager.java   | 5 +++++
 .../org/apache/james/mailbox/store/StoreRightManager.java     | 7 +++++++
 server/protocols/jmap/pom.xml                                 | 4 ----
 .../apache/james/jmap/event/PropagateLookupRightListener.java | 2 +-
 .../jmap/DefaultMailboxesProvisioningFilterThreadTest.java    | 5 +++++
 6 files changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/21e7ff9e/mailbox/api/src/main/java/org/apache/james/mailbox/RightManager.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/RightManager.java b/mailbox/api/src/main/java/org/apache/james/mailbox/RightManager.java
index c021f92..c397d29 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/RightManager.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/RightManager.java
@@ -53,6 +53,7 @@ public interface RightManager {
      * @throws MailboxException in case of unknown mailbox or unsupported right
      */
     boolean hasRight(MailboxId mailboxId, Right right, 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}.
@@ -77,6 +78,8 @@ public interface RightManager {
      */
     MailboxACL.Rfc4314Rights[] listRigths(MailboxPath mailboxPath, MailboxACL.EntryKey identifier,
MailboxSession session) throws MailboxException;
 
+    MailboxACL listRights(MailboxPath mailboxPath, MailboxSession session) throws MailboxException;
+
     /**
      * Returns the rights applicable to the user who has sent the current
      * request on the mailbox designated by this mailboxPath.

http://git-wip-us.apache.org/repos/asf/james-project/blob/21e7ff9e/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 5f499aa..2fcb9b7 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
@@ -792,6 +792,11 @@ public class StoreMailboxManager implements MailboxManager {
     }
 
     @Override
+    public MailboxACL listRights(MailboxPath mailboxPath, MailboxSession session) throws
MailboxException {
+        return storeRightManager.listRights(mailboxPath, session);
+    }
+
+    @Override
     public void applyRightsCommand(MailboxPath mailboxPath, MailboxACL.ACLCommand mailboxACLCommand,
MailboxSession session) throws MailboxException {
         storeRightManager.applyRightsCommand(mailboxPath, mailboxACLCommand, session);
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/21e7ff9e/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java
index ef4a31b..92033f7 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreRightManager.java
@@ -124,6 +124,13 @@ public class StoreRightManager implements RightManager {
     }
 
     @Override
+    public MailboxACL listRights(MailboxPath mailboxPath, MailboxSession session) throws
MailboxException {
+        MailboxMapper mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
+        Mailbox mailbox = mapper.findMailboxByPath(mailboxPath);
+        return mailbox.getACL();
+    }
+
+    @Override
     public void applyRightsCommand(MailboxPath mailboxPath, ACLCommand mailboxACLCommand,
MailboxSession session) throws MailboxException {
         assertSharesBelongsToUserDomain(mailboxPath.getUser(), mailboxACLCommand);
         MailboxMapper mapper = mailboxSessionMapperFactory.getMailboxMapper(session);

http://git-wip-us.apache.org/repos/asf/james-project/blob/21e7ff9e/server/protocols/jmap/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/pom.xml b/server/protocols/jmap/pom.xml
index f03b6e4..5cebbd0 100644
--- a/server/protocols/jmap/pom.xml
+++ b/server/protocols/jmap/pom.xml
@@ -45,10 +45,6 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>apache-james-mailbox-store</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
             <artifactId>apache-james-mailbox-memory</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/21e7ff9e/server/protocols/jmap/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
index fe12d68..c22e9a4 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/event/PropagateLookupRightListener.java
@@ -83,7 +83,7 @@ public class PropagateLookupRightListener implements MailboxListener {
                             .entrySet()
                             .stream()
                             .map(entry -> new Entry(entry.getKey(), entry.getValue()))
-                ));
+                    ));
         } catch (MailboxException e) {
             Throwables.propagate(e);
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/21e7ff9e/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 69bfa0f..78430f4 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
@@ -215,6 +215,11 @@ public class DefaultMailboxesProvisioningFilterThreadTest {
         }
 
         @Override
+        public MailboxACL listRights(MailboxPath mailboxPath, MailboxSession session) throws
MailboxException {
+            return null;
+        }
+
+        @Override
         public void applyRightsCommand(MailboxPath mailboxPath, MailboxACL.ACLCommand mailboxACLCommand,
MailboxSession session) throws MailboxException {
             throw new NotImplementedException();
         }


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


Mime
View raw message