james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [03/19] james-project git commit: JAMES-2616 replace getSession() in PropagateLookupRightListener
Date Fri, 07 Dec 2018 01:10:26 GMT
JAMES-2616 replace getSession() in PropagateLookupRightListener


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

Branch: refs/heads/master
Commit: 4602954081b787e908336575642c4bb99e73d39f
Parents: 2cc43bc
Author: tran tien duc <dtran@linagora.com>
Authored: Fri Nov 30 11:56:12 2018 +0700
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Fri Dec 7 07:52:50 2018 +0700

----------------------------------------------------------------------
 .../james/jmap/event/PropagateLookupRightListener.java  | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/46029540/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 88b4b48..cdf1701 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
@@ -44,7 +44,7 @@ public class PropagateLookupRightListener implements MailboxListener {
     private final MailboxManager mailboxManager;
 
     @Inject
-    PropagateLookupRightListener(RightManager rightManager, MailboxManager mailboxManager)
{
+    public PropagateLookupRightListener(RightManager rightManager, MailboxManager mailboxManager)
{
         this.rightManager = rightManager;
         this.mailboxManager = mailboxManager;
     }
@@ -57,7 +57,7 @@ public class PropagateLookupRightListener implements MailboxListener {
     @Override
     public void event(Event event) {
         try {
-            MailboxSession mailboxSession = event.getSession();
+            MailboxSession mailboxSession = createMailboxSession(event);
 
             if (event instanceof MailboxACLUpdated) {
                 MailboxACLUpdated aclUpdateEvent = (MailboxACLUpdated) event;
@@ -73,6 +73,14 @@ public class PropagateLookupRightListener implements MailboxListener {
         }
     }
 
+    private MailboxSession createMailboxSession(Event event) {
+        try {
+            return mailboxManager.createSystemSession(event.getUser().asString());
+        } catch (MailboxException e) {
+            throw new RuntimeException("unable to create system session of user:" + event.getUser().toString(),
e);
+        }
+    }
+
     private void updateLookupRightOnParent(MailboxSession session, MailboxPath path) throws
MailboxException {
         MailboxACL acl = rightManager.listRights(path, session);
         listAncestors(session, path)


---------------------------------------------------------------------
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