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 <dt...@linagora.com> Authored: Fri Nov 30 11:56:12 2018 +0700 Committer: Benoit Tellier <btell...@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-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org