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 ad...@apache.org on 2017/11/15 08:02:03 UTC
[05/11] james-project git commit: MAILBOX-316 StoreRightManager
dispatchs even to update 'l' right on parent when set right on child
MAILBOX-316 StoreRightManager dispatchs even to update 'l' right on
parent when set right on child
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/2aa77b5e
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/2aa77b5e
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/2aa77b5e
Branch: refs/heads/master
Commit: 2aa77b5e45b56affa733bf46ec7cf96d99a093dc
Parents: 75622f7
Author: quynhn <qn...@linagora.com>
Authored: Mon Nov 6 16:06:17 2017 +0700
Committer: quynhn <qn...@linagora.com>
Committed: Wed Nov 15 09:33:58 2017 +0700
----------------------------------------------------------------------
.../apache/james/mailbox/store/StoreRightManager.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/2aa77b5e/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 51c021f..66516c4 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
@@ -28,6 +28,7 @@ import javax.mail.Flags;
import org.apache.james.core.User;
import org.apache.james.mailbox.MailboxSession;
import org.apache.james.mailbox.RightManager;
+import org.apache.james.mailbox.acl.ACLDiff;
import org.apache.james.mailbox.acl.GroupMembershipResolver;
import org.apache.james.mailbox.acl.MailboxACLResolver;
import org.apache.james.mailbox.exception.DifferentDomainException;
@@ -129,6 +130,9 @@ public class StoreRightManager implements RightManager {
MailboxMapper mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
Mailbox mailbox = mapper.findMailboxByPath(mailboxPath);
mapper.execute(Mapper.toTransaction(() -> mapper.updateACL(mailbox, mailboxACLCommand)));
+
+ ACLDiff aclDiff = ACLDiff.computeDiff(mailbox.getACL(), mailbox.getACL().apply(mailboxACLCommand));
+ dispatcher.aclUpdated(session, mailboxPath, aclDiff);
}
private void assertSharesBelongsToUserDomain(String user, ACLCommand mailboxACLCommand) throws DifferentDomainException {
@@ -183,7 +187,7 @@ public class StoreRightManager implements RightManager {
MailboxMapper mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
Mailbox mailbox = mapper.findMailboxByPath(mailboxPath);
- setRights(mailboxACL, mapper, mailbox);
+ setRights(mailboxACL, mapper, mailbox, session);
}
@VisibleForTesting
@@ -203,8 +207,11 @@ public class StoreRightManager implements RightManager {
return !domain.equals(otherDomain);
}
- private void setRights(MailboxACL mailboxACL, MailboxMapper mapper, Mailbox mailbox) throws MailboxException {
+ private void setRights(MailboxACL mailboxACL, MailboxMapper mapper, Mailbox mailbox, MailboxSession session) throws MailboxException {
mapper.execute(Mapper.toTransaction(() -> mapper.setACL(mailbox, mailboxACL)));
+
+ ACLDiff aclDiff = ACLDiff.computeDiff(mailbox.getACL(), mailboxACL);
+ dispatcher.aclUpdated(session, mailbox.generateAssociatedPath(), aclDiff);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org