You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2023/10/06 02:06:44 UTC
[james-project] 21/23: JAMES-3942 Audit trail upon JMAP rights sharing changed
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 144942c5fdfb5e0e0b71da3049074800fd4a0b51
Author: Quan Tran <hq...@linagora.com>
AuthorDate: Thu Sep 28 16:22:37 2023 +0700
JAMES-3942 Audit trail upon JMAP rights sharing changed
---
.../james/jmap/method/MailboxSetUpdatePerformer.scala | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala
index dc938f5b40..58f4598a88 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala
@@ -19,6 +19,7 @@
package org.apache.james.jmap.method
+import com.google.common.collect.ImmutableMap
import eu.timepit.refined.auto._
import javax.inject.Inject
import org.apache.james.jmap.core.CapabilityIdentifier.CapabilityIdentifier
@@ -32,10 +33,11 @@ import org.apache.james.mailbox.exception.{InsufficientRightsException, MailboxE
import org.apache.james.mailbox.model.search.{MailboxQuery, PrefixedWildcard}
import org.apache.james.mailbox.model.{MailboxId, MailboxPath}
import org.apache.james.mailbox.{MailboxManager, MailboxSession, MessageManager, Role, SubscriptionManager}
-import org.apache.james.util.ReactorUtils
+import org.apache.james.util.{AuditTrail, ReactorUtils}
import reactor.core.scala.publisher.{SFlux, SMono}
import scala.jdk.CollectionConverters._
+import scala.jdk.OptionConverters._
object MailboxSetUpdatePerformer {
@@ -215,7 +217,17 @@ class MailboxSetUpdatePerformer @Inject()(serializer: MailboxSerializer,
}).getOrElse(SMono.empty)
val partialUpdatesOperation: SMono[Unit] = SFlux.fromIterable(validatedPatch.rightsPartialUpdates)
- .flatMap(partialUpdate => SMono.fromCallable(() => mailboxManager.applyRightsCommand(mailboxId, partialUpdate.asACLCommand(), mailboxSession)),
+ .flatMap(partialUpdate => SMono.fromCallable(() => mailboxManager.applyRightsCommand(mailboxId, partialUpdate.asACLCommand(), mailboxSession))
+ .doOnSuccess(_ => AuditTrail.entry
+ .username(mailboxSession.getUser.asString())
+ .protocol("JMAP")
+ .action("Mailbox/set update")
+ .parameters(ImmutableMap.of("loggedInUser", mailboxSession.getLoggedInUser.toScala.map(_.asString()).getOrElse(""),
+ "delegator", mailboxSession.getUser.asString(),
+ "delegatee", partialUpdate.username.asString(),
+ "mailboxId", mailboxId.serialize(),
+ "rights", partialUpdate.rights.asJava.serialize()))
+ .log("JMAP mailbox shared.")),
maxConcurrency = 5)
.`then`()
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org