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 c505aabcac03968368474100fa5c622ae4a0f5ea Author: Benoit TELLIER <btell...@linagora.com> AuthorDate: Wed Nov 20 11:59:23 2024 +0100 JAMES-4090 Documentation forclosing users channels --- .../modules/servers/partials/operate/webadmin.adoc | 54 ++++++++++++++++++++- .../protocols/webadmin/ProtocolServerRoutes.java | 4 +- src/site/markdown/server/manage-webadmin.md | 55 +++++++++++++++++++++- 3 files changed, 107 insertions(+), 6 deletions(-) diff --git a/docs/modules/servers/partials/operate/webadmin.adoc b/docs/modules/servers/partials/operate/webadmin.adoc index 196e3401f1..9403184aaa 100644 --- a/docs/modules/servers/partials/operate/webadmin.adoc +++ b/docs/modules/servers/partials/operate/webadmin.adoc @@ -4733,7 +4733,9 @@ This is an example of returned body. } .... -== Reloading server certificates +== Server administration + +=== Reloading server certificates Certificates for TCP based protocols (IMAP, SMTP, POP3, LMTP and ManageSieve) can be updated at runtime, without service interuption and without closing existing connections. @@ -4754,4 +4756,52 @@ Optional query parameters: Return code: - 204: the certificate is reloaded -- 400: Invalid request. \ No newline at end of file +- 400: Invalid request. + +=== Disconnecting users + +James maintains a set of stateful connections and provide an API allowing to close any of the existing +connections, including: + + - IMAP protocol + - SMTP protocol + - JMAP websocket and event source sub protocols + +James keeps track of active channels and would iterate through them, destroying corresponding channels. + +==== Disconnecting a specific user + +.... +curl -XDELETE /servers/channels/b...@domain.tld +.... + +Will destroy channels belonging to `b...@domain.tld`. + +Return code: + +- 204: the certificate is reloaded + +==== Disconnecting all users + +.... +curl -XDELETE /servers/channels +.... + +Will close all channels. + +Return code: + +- 204: the certificate is reloaded + +==== Disconnecting a group of users + +.... +curl -XDELETE /servers/channels -d `["badg...@domain.tld","badg...@domain.tld"]` +.... + +Will disconnect `badg...@domain.tld` and `badg...@domain.tld`. + +Return code: + +- 204: the certificate is reloaded +- 400: Invalid request diff --git a/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java b/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java index d0b9de4c1c..c1901f7f15 100644 --- a/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java +++ b/server/protocols/webadmin/webadmin-protocols/src/main/java/org/apache/james/protocols/webadmin/ProtocolServerRoutes.java @@ -88,14 +88,14 @@ public class ProtocolServerRoutes implements Routes { return Responses.returnNoContent(response); }); - service.delete(SERVERS + "/users/:user", (request, response) -> { + service.delete(SERVERS + "/channels/:user", (request, response) -> { Username username = Username.of(request.params("user")); disconnector.disconnect(username::equals); return Responses.returnNoContent(response); }); - service.delete(SERVERS + "/users", (request, response) -> { + service.delete(SERVERS + "/channels", (request, response) -> { String body = request.body(); if (Strings.isNullOrEmpty(body)) { diff --git a/src/site/markdown/server/manage-webadmin.md b/src/site/markdown/server/manage-webadmin.md index a8836ca75f..d1ddc4ba01 100644 --- a/src/site/markdown/server/manage-webadmin.md +++ b/src/site/markdown/server/manage-webadmin.md @@ -4921,7 +4921,10 @@ Response codes : - 201: the taskId of the created task - 400: Invalid action argument for performing operation on mappings data -## Reloading server certificates + +## Server administration + +### Reloading server certificates Certificates for TCP based protocols (IMAP, SMTP, POP3, LMTP and ManageSieve) can be updated at runtime, without service interuption and without closing existing connections. @@ -4942,4 +4945,52 @@ Optional query parameters: Return code: - 204: the certificate is reloaded - - 400: Invalid request. \ No newline at end of file + - 400: Invalid request. + +### Disconnecting users + +James maintains a set of stateful connections and provide an API allowing to close any of the existing +connections, including: + +- IMAP protocol +- SMTP protocol +- JMAP websocket and event source sub protocols + +James keeps track of active channels and would iterate through them, destroying corresponding channels. + +#### Disconnecting a specific user + +``` +curl -XDELETE /servers/channels/b...@domain.tld +``` + +Will destroy channels belonging to `b...@domain.tld`. + +Return code: + +- 204: the certificate is reloaded + +#### Disconnecting all users + +``` +curl -XDELETE /servers/channels +``` + +Will close all channels. + +Return code: + +- 204: the certificate is reloaded + +#### Disconnecting a group of users + +``` +curl -XDELETE /servers/channels -d `["badg...@domain.tld","badg...@domain.tld"]` +``` + +Will disconnect `badg...@domain.tld` and `badg...@domain.tld`. + +Return code: + +- 204: the certificate is reloaded +- 400: Invalid request \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org