You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2023/01/11 02:35:30 UTC
[james-project] 01/03: JAMES-3756 Introduce DelegationProbe
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 5d371177b2c15dccf008829a71cac50b50588a80
Author: Quan Tran <hq...@linagora.com>
AuthorDate: Mon Jan 9 15:09:05 2023 +0700
JAMES-3756 Introduce DelegationProbe
---
.../rfc8621/contract/probe/DelegationProbe.scala | 42 ++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/probe/DelegationProbe.scala b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/probe/DelegationProbe.scala
new file mode 100644
index 0000000000..b966141db6
--- /dev/null
+++ b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/probe/DelegationProbe.scala
@@ -0,0 +1,42 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.jmap.rfc8621.contract.probe
+
+import com.google.inject.AbstractModule
+import com.google.inject.multibindings.Multibinder
+import javax.inject.Inject
+import org.apache.james.core.Username
+import org.apache.james.user.api.DelegationStore
+import org.apache.james.utils.GuiceProbe
+import reactor.core.scala.publisher.SFlux
+
+class DelegationProbeModule extends AbstractModule {
+ override def configure(): Unit =
+ Multibinder.newSetBinder(binder(), classOf[GuiceProbe])
+ .addBinding()
+ .to(classOf[DelegationProbe])
+}
+
+class DelegationProbe @Inject()(delegationStore: DelegationStore) extends GuiceProbe {
+ def getAuthorizedUsers(baseUser: Username): Seq[Username] =
+ SFlux.fromPublisher(delegationStore.authorizedUsers(baseUser))
+ .collectSeq()
+ .block()
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org