[james-project] 03/03: JAMES-3909 Add listing failedUsers to task additional information
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 375aebbd21cb4bf16a9a9cc74df221a86a6abc83 Author: Quan Tran AuthorDate: Mon May 22 16:52:30 2023 +0700 JAMES-3909 Add listing failedUsers to task additional information --- .../docs/modules/ROOT/pages/operate/webadmin.adoc | 3 +++ .../service/DeleteUsersDataOfDomainTask.java | 27 -- ...rsDataOfDomainTaskAdditionalInformationDTO.java | 26 +++-- .../james/webadmin/routes/DomainsRoutesTest.java | 7 -- ...leteUsersDataOfDomainTaskSerializationTest.java | 13 +-- .../service/DeleteUsersDataOfDomainTaskTest.java | 5 src/site/markdown/server/manage-webadmin.md| 3 +++ 7 files changed, 76 insertions(+), 8 deletions(-) diff --git a/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc b/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc index 0a69f5618f..fa1a311569 100644 --- a/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc +++ b/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc @@ -478,10 +478,13 @@ The scheduled task will have the following type `DeleteUsersDataOfDomainTask` an "domain": "domain.tld", "successfulUsersCount": 2, "failedUsersCount": 1, +"failedUsers": ["failedu...@domain.tld"], "timestamp": "2023-05-22T08:52:47.076261Z" } +Notes: `failedUsers` only lists maximum 100 failed users. + == Administrating users === Create a user diff --git a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUsersDataOfDomainTask.java b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUsersDataOfDomainTask.java index 84487aade6..146fa7a787 100644 --- a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUsersDataOfDomainTask.java +++ b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUsersDataOfDomainTask.java @@ -23,6 +23,8 @@ import java.time.Clock; import java.time.Instant; import java.util.Objects; import java.util.Optional; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Function; @@ -42,18 +44,21 @@ import reactor.core.publisher.Mono; public class DeleteUsersDataOfDomainTask implements Task { static final TaskType TYPE = TaskType.of("DeleteUsersDataOfDomainTask"); private static final int LOW_CONCURRENCY = 2; +private static final int MAX_STORED_FAILED_USERS = 100; public static class AdditionalInformation implements TaskExecutionDetails.AdditionalInformation { private final Instant timestamp; private final Domain domain; private final long successfulUsersCount; private final long failedUsersCount; +private final Set failedUsers; -public AdditionalInformation(Instant timestamp, Domain domain, long successfulUsersCount, long failedUsersCount) { +public AdditionalInformation(Instant timestamp, Domain domain, long successfulUsersCount, long failedUsersCount, Set failedUsers) { this.timestamp = timestamp; this.domain = domain; this.successfulUsersCount = successfulUsersCount; this.failedUsersCount = failedUsersCount; +this.failedUsers = failedUsers; } public Domain getDomain() { @@ -68,6 +73,10 @@ public class DeleteUsersDataOfDomainTask implements Task { return failedUsersCount; } +public Set getFailedUsers() { +return failedUsers; +} + @Override public Instant timestamp() { return timestamp; @@ -95,10 +104,12 @@ public class DeleteUsersDataOfDomainTask implements Task { static class Context { private final AtomicLong successfulUsersCount; private final AtomicLong failedUsersCount; +private final Set failedUsers; public Context() { this.successfulUsersCount = new AtomicLong(); this.failedUsersCount = new AtomicLong(); +this.failedUsers = ConcurrentHashMap.newKeySet(); } private void increaseSuccessfulUsers() { @@ -109,6 +120,10 @@ public class DeleteUsersDataOfDomainTask implements Task { failedUsersCount.incrementAndGet(); } +private void addFailedUser(Username username) { +failedUsers.add(username); +} + public long getSuccessfulUsersCount() { return successfulUsersCount.get(); } @@ -116,6 +131,10 @@ public class DeleteUsersDataOfDomainTask implements Task { public long
[james-project] branch master updated (d7e717632e -> 375aebbd21)
This is an automated email from the ASF dual-hosted git repository. btellier pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git from d7e717632e JAMES-3909 Mailboxes deletion step (#1571) new 79092f2142 JAMES-3909 Task + Webadmin route for delete all users data of a domain new 1baee47628 JAMES-3909 Add UsersRepository::listUsersOfADomainReactive new 375aebbd21 JAMES-3909 Add listing failedUsers to task additional information The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../docs/modules/ROOT/pages/operate/webadmin.adoc | 30 .../james/modules/server/DataRoutesModules.java| 20 +++ .../org/apache/james/user/api/UsersRepository.java | 10 ++ .../james/user/lib/UsersRepositoryContract.java| 16 ++ .../james/webadmin/routes/DomainsRoutes.java | 33 +++- .../webadmin/service/DeleteUserDataService.java| 4 + .../service/DeleteUsersDataOfDomainTask.java | 196 ...rsDataOfDomainTaskAdditionalInformationDTO.java | 103 +++ .../service/DeleteUsersDataOfDomainTaskDTO.java} | 42 +++-- .../james/webadmin/routes/DomainsRoutesTest.java | 177 +- ...eteUsersDataOfDomainTaskSerializationTest.java} | 82 +++-- .../service/DeleteUsersDataOfDomainTaskTest.java | 199 + src/site/markdown/server/manage-webadmin.md| 31 13 files changed, 865 insertions(+), 78 deletions(-) create mode 100644 server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUsersDataOfDomainTask.java create mode 100644 server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUsersDataOfDomainTaskAdditionalInformationDTO.java copy server/protocols/webadmin/{webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/EventDeadLettersRedeliverAllTaskDTO.java => webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUsersDataOfDomainTaskDTO.java} (54%) copy server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/service/{DeleteUserDataTaskSerializationTest.java => DeleteUsersDataOfDomainTaskSerializationTest.java} (53%) create mode 100644 server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/service/DeleteUsersDataOfDomainTaskTest.java - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 02/03: JAMES-3909 Add UsersRepository::listUsersOfADomainReactive
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 1baee47628621729c0e9da5e1a2f2724e1ef86fe Author: Quan Tran AuthorDate: Mon May 22 10:58:23 2023 +0700 JAMES-3909 Add UsersRepository::listUsersOfADomainReactive The user listing + filtering by domain is not really optimized. Therefore, it is a default method for now, and people can optimize/override it later. --- .../java/org/apache/james/user/api/UsersRepository.java | 10 ++ .../apache/james/user/lib/UsersRepositoryContract.java | 16 2 files changed, 26 insertions(+) diff --git a/server/data/data-api/src/main/java/org/apache/james/user/api/UsersRepository.java b/server/data/data-api/src/main/java/org/apache/james/user/api/UsersRepository.java index 34c99decef..4a3e67523b 100644 --- a/server/data/data-api/src/main/java/org/apache/james/user/api/UsersRepository.java +++ b/server/data/data-api/src/main/java/org/apache/james/user/api/UsersRepository.java @@ -21,11 +21,14 @@ package org.apache.james.user.api; import java.util.Iterator; +import org.apache.james.core.Domain; import org.apache.james.core.MailAddress; import org.apache.james.core.Username; import org.apache.james.user.api.model.User; import org.reactivestreams.Publisher; +import reactor.core.publisher.Flux; + /** * Interface for a repository of users. A repository represents a logical * grouping of users, typically by common purpose. E.g. the users served by an @@ -170,4 +173,11 @@ public interface UsersRepository { throw new UsersRepositoryException(username.asString() + " username candidate do not match the virtualHosting strategy"); } } + +default Publisher listUsersOfADomainReactive(Domain domain) { +return Flux.from(listReactive()) +.filter(username -> username.getDomainPart() +.map(domain::equals) +.orElse(false)); +} } diff --git a/server/data/data-library/src/test/java/org/apache/james/user/lib/UsersRepositoryContract.java b/server/data/data-library/src/test/java/org/apache/james/user/lib/UsersRepositoryContract.java index 8fe9e17c71..f13dfa473f 100644 --- a/server/data/data-library/src/test/java/org/apache/james/user/lib/UsersRepositoryContract.java +++ b/server/data/data-library/src/test/java/org/apache/james/user/lib/UsersRepositoryContract.java @@ -50,6 +50,8 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; +import reactor.core.publisher.Flux; + public interface UsersRepositoryContract { class UserRepositoryExtension implements BeforeEachCallback, ParameterResolver { @@ -551,6 +553,20 @@ public interface UsersRepositoryContract { assertThat(actual).isTrue(); } +@Test +default void listUsersOfADomainShouldNotListOtherDomainUsers(TestSystem testSystem) throws Exception { +testSystem.domainList.addDomain(Domain.of("domain1.tld")); +testee().addUser(Username.of("us...@domain1.tld"), "password"); + +testSystem.domainList.addDomain(Domain.of("domain2.tld")); +testee().addUser(Username.of("us...@domain2.tld"), "password"); + + assertThat(Flux.from(testee().listUsersOfADomainReactive(Domain.of("domain1.tld"))) +.collectList() +.block()) +.containsOnly(Username.of("us...@domain1.tld")); +} + @Test default void addUserShouldThrowWhenUserDoesNotBelongToDomainList(TestSystem testSystem) { assertThatThrownBy(() -> testee().addUser(testSystem.userWithUnknownDomain, "password")) - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 01/03: JAMES-3909 Task + Webadmin route for delete all users data of a domain
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 79092f21427011722b656fca5c58b5044235424f Author: Quan Tran AuthorDate: Fri May 19 17:18:51 2023 +0700 JAMES-3909 Task + Webadmin route for delete all users data of a domain --- .../docs/modules/ROOT/pages/operate/webadmin.adoc | 27 +++ .../james/modules/server/DataRoutesModules.java| 20 +++ .../james/webadmin/routes/DomainsRoutes.java | 33 +++- .../webadmin/service/DeleteUserDataService.java| 4 + .../service/DeleteUsersDataOfDomainTask.java | 173 ++ ...rsDataOfDomainTaskAdditionalInformationDTO.java | 81 + .../service/DeleteUsersDataOfDomainTaskDTO.java| 68 .../james/webadmin/routes/DomainsRoutesTest.java | 174 +- ...leteUsersDataOfDomainTaskSerializationTest.java | 93 ++ .../service/DeleteUsersDataOfDomainTaskTest.java | 194 + src/site/markdown/server/manage-webadmin.md| 28 +++ 11 files changed, 892 insertions(+), 3 deletions(-) diff --git a/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc b/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc index 1a343c7d30..0a69f5618f 100644 --- a/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc +++ b/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc @@ -455,6 +455,33 @@ syntax * 400: source, domain and destination domain are the same * 404: `source.domain.tld` are not part of handled domains. +=== Delete all users data of a domain + + +curl -XPOST http://ip:port/domains/{domainToBeUsed}?action=deleteData + + +Would create a task that deletes data of all users of the domain. + +[More details about endpoints returning a task](#_endpoints_returning_a_task). + +Response codes: + +* 201: Success. Corresponding task id is returned. +* 400: Error in the request. Details can be found in the reported error. + +The scheduled task will have the following type `DeleteUsersDataOfDomainTask` and the following `additionalInformation`: + + +{ +"type": "DeleteUsersDataOfDomainTask", +"domain": "domain.tld", +"successfulUsersCount": 2, +"failedUsersCount": 1, +"timestamp": "2023-05-22T08:52:47.076261Z" +} + + == Administrating users === Create a user diff --git a/server/container/guice/protocols/webadmin-data/src/main/java/org/apache/james/modules/server/DataRoutesModules.java b/server/container/guice/protocols/webadmin-data/src/main/java/org/apache/james/modules/server/DataRoutesModules.java index 5b3addf079..48fcf5efe2 100644 --- a/server/container/guice/protocols/webadmin-data/src/main/java/org/apache/james/modules/server/DataRoutesModules.java +++ b/server/container/guice/protocols/webadmin-data/src/main/java/org/apache/james/modules/server/DataRoutesModules.java @@ -25,6 +25,7 @@ import org.apache.james.server.task.json.dto.TaskDTO; import org.apache.james.server.task.json.dto.TaskDTOModule; import org.apache.james.task.Task; import org.apache.james.task.TaskExecutionDetails; +import org.apache.james.user.api.UsersRepository; import org.apache.james.webadmin.Routes; import org.apache.james.webadmin.dto.DTOModuleInjections; import org.apache.james.webadmin.dto.MappingSourceModule; @@ -44,6 +45,8 @@ import org.apache.james.webadmin.routes.UsernameChangeRoutes; import org.apache.james.webadmin.service.DeleteUserDataService; import org.apache.james.webadmin.service.DeleteUserDataTaskAdditionalInformationDTO; import org.apache.james.webadmin.service.DeleteUserDataTaskDTO; +import org.apache.james.webadmin.service.DeleteUsersDataOfDomainTaskAdditionalInformationDTO; +import org.apache.james.webadmin.service.DeleteUsersDataOfDomainTaskDTO; import org.apache.james.webadmin.service.UsernameChangeService; import org.apache.james.webadmin.service.UsernameChangeTaskAdditionalInformationDTO; import org.apache.james.webadmin.service.UsernameChangeTaskDTO; @@ -108,4 +111,21 @@ public class DataRoutesModules extends AbstractModule { public AdditionalInformationDTOModule webAdminDeleteUserDataTaskAdditionalInformationDTO() { return DeleteUserDataTaskAdditionalInformationDTO.module(); } + +// delete all users data of a domain DTO modules +@ProvidesIntoSet +public TaskDTOModule deleteUsersDataOfDomainTaskDTO(DeleteUserDataService service, UsersRepository usersRepository) { +return DeleteUsersDataOfDomainTaskDTO.module(service, usersRepository); +} + +@ProvidesIntoSet +public AdditionalInformationDTOModule deleteUsersDataOfDomainTaskAdditionalInformationDTO() { +return DeleteUsersDataOfDomainTaskAdditionalInformationDTO.module(); +} + +@Named(DTOModuleInjections.WEBADMIN_DTO) +@ProvidesIntoSet +public
[GitHub] [james-project] chibenwa merged pull request #1570: JAMES-3909 Delete all users data of a domain
chibenwa merged PR #1570: URL: https://github.com/apache/james-project/pull/1570 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] branch master updated: JAMES-3909 Mailboxes deletion step (#1571)
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 The following commit(s) were added to refs/heads/master by this push: new d7e717632e JAMES-3909 Mailboxes deletion step (#1571) d7e717632e is described below commit d7e717632ea2de8efa4e7ac05df54b7be7a58cec Author: Trần Hồng Quân <55171818+quantranhong1...@users.noreply.github.com> AuthorDate: Thu May 25 12:44:54 2023 +0700 JAMES-3909 Mailboxes deletion step (#1571) Delete mailboxes + messages + ACLs + subscriptions upon user data deletion. --- .../modules/mailbox/CassandraMailboxModule.java| 5 + .../james/modules/mailbox/JPAMailboxModule.java| 5 + .../james/modules/mailbox/MemoryMailboxModule.java | 5 + .../mailbox/MailboxUserDeletionTaskStep.java | 109 +++ .../mailbox/MailboxUserDeletionTaskStepTest.java | 212 + .../memory/MemoryUserDeletionIntegrationTest.java | 111 +++ 6 files changed, 447 insertions(+) diff --git a/server/container/guice/cassandra/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java b/server/container/guice/cassandra/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java index 174ed29b0b..81e6f3d411 100644 --- a/server/container/guice/cassandra/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java +++ b/server/container/guice/cassandra/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java @@ -23,6 +23,7 @@ import static org.apache.james.modules.Names.MAILBOXMANAGER_NAME; import javax.inject.Singleton; import org.apache.james.adapter.mailbox.ACLUsernameChangeTaskStep; +import org.apache.james.adapter.mailbox.MailboxUserDeletionTaskStep; import org.apache.james.adapter.mailbox.MailboxUsernameChangeTaskStep; import org.apache.james.adapter.mailbox.QuotaUsernameChangeTaskStep; import org.apache.james.adapter.mailbox.UserRepositoryAuthenticator; @@ -117,6 +118,7 @@ import org.apache.james.mailbox.store.mail.ModSeqProvider; import org.apache.james.mailbox.store.mail.ThreadIdGuessingAlgorithm; import org.apache.james.mailbox.store.mail.UidProvider; import org.apache.james.mailbox.store.user.SubscriptionMapperFactory; +import org.apache.james.user.api.DeleteUserDataTaskStep; import org.apache.james.user.api.UsernameChangeTaskStep; import org.apache.james.utils.MailboxManagerDefinition; import org.apache.mailbox.tools.indexer.MessageIdReIndexerImpl; @@ -250,6 +252,9 @@ public class CassandraMailboxModule extends AbstractModule { usernameChangeTaskStepMultibinder.addBinding().to(MailboxUsernameChangeTaskStep.class); usernameChangeTaskStepMultibinder.addBinding().to(ACLUsernameChangeTaskStep.class); usernameChangeTaskStepMultibinder.addBinding().to(QuotaUsernameChangeTaskStep.class); + +Multibinder deleteUserDataTaskStepMultibinder = Multibinder.newSetBinder(binder(), DeleteUserDataTaskStep.class); + deleteUserDataTaskStepMultibinder.addBinding().to(MailboxUserDeletionTaskStep.class); } @Provides diff --git a/server/container/guice/mailbox-jpa/src/main/java/org/apache/james/modules/mailbox/JPAMailboxModule.java b/server/container/guice/mailbox-jpa/src/main/java/org/apache/james/modules/mailbox/JPAMailboxModule.java index 5bf648d6d8..f56415cb62 100644 --- a/server/container/guice/mailbox-jpa/src/main/java/org/apache/james/modules/mailbox/JPAMailboxModule.java +++ b/server/container/guice/mailbox-jpa/src/main/java/org/apache/james/modules/mailbox/JPAMailboxModule.java @@ -23,6 +23,7 @@ import static org.apache.james.modules.Names.MAILBOXMANAGER_NAME; import javax.inject.Singleton; import org.apache.james.adapter.mailbox.ACLUsernameChangeTaskStep; +import org.apache.james.adapter.mailbox.MailboxUserDeletionTaskStep; import org.apache.james.adapter.mailbox.MailboxUsernameChangeTaskStep; import org.apache.james.adapter.mailbox.QuotaUsernameChangeTaskStep; import org.apache.james.adapter.mailbox.UserRepositoryAuthenticator; @@ -62,6 +63,7 @@ import org.apache.james.mailbox.store.mail.UidProvider; import org.apache.james.mailbox.store.mail.model.DefaultMessageId; import org.apache.james.mailbox.store.user.SubscriptionMapperFactory; import org.apache.james.modules.data.JPAEntityManagerModule; +import org.apache.james.user.api.DeleteUserDataTaskStep; import org.apache.james.user.api.UsernameChangeTaskStep; import org.apache.james.utils.MailboxManagerDefinition; import org.apache.mailbox.tools.indexer.ReIndexerImpl; @@ -130,6 +132,9 @@ public class JPAMailboxModule extends AbstractModule { usernameChangeTaskStepMultibinder.addBinding().to(MailboxUsernameChangeTaskStep.class); usernameChangeTaskStepMultibinder.addBinding().to(ACLUsernameChangeTaskStep.class);
[GitHub] [james-project] chibenwa merged pull request #1571: JAMES-3909 Mailboxes deletion step
chibenwa merged PR #1571: URL: https://github.com/apache/james-project/pull/1571 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] Arsnael commented on pull request #1573: JAMES-3906 Allow to reload SSL certificates
Arsnael commented on PR #1573: URL: https://github.com/apache/james-project/pull/1573#issuecomment-1562260244 ``` 04:31:15,958 [ERROR] The build could not read 1 project -> [Help 1] org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: [WARNING] 'parent.relativePath' of POM org.apache.james:james-server-webadmin-protocols:3.8.0-SNAPSHOT (/home/jenkins/workspace/james_ApacheJames_PR-1573/server/protocols/webadmin/webadmin-protocols/pom.xml) points at org.apache.james:james-server-webadmin instead of org.apache.james:james-server, please verify your project structure @ line 5, column 13 [FATAL] Non-resolvable parent POM for org.apache.james:james-server-webadmin-protocols:3.8.0-SNAPSHOT: The following artifacts could not be resolved: org.apache.james:james-server:pom:3.8.0-SNAPSHOT (absent): Could not find artifact org.apache.james:james-server:pom:3.8.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 5, column 13 ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] Arsnael commented on a diff in pull request #1573: JAMES-3906 Allow to reload SSL certificates
Arsnael commented on code in PR #1573: URL: https://github.com/apache/james-project/pull/1573#discussion_r1204986906 ## server/protocols/webadmin/webadmin-protocols/pom.xml: ## @@ -0,0 +1,46 @@ + Review Comment: License missing -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] chibenwa commented on pull request #1559: JAMES-3906 Add hot reloading/updating of the certificate: new interfa…
chibenwa commented on PR #1559: URL: https://github.com/apache/james-project/pull/1559#issuecomment-1562251286 Hello @woj-tek I took the liberty today to shoot a PR with my suggestions. I would encourage you taking a look at it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] chibenwa opened a new pull request, #1573: JAMES-3906 Allow to reload SSL certificates
chibenwa opened a new pull request, #1573: URL: https://github.com/apache/james-project/pull/1573 Rework of https://github.com/apache/james-project/pull/1559 - Do not import webadmin in all protocols projects (prevent breaking orthogonal architecture) - Centralize certificate renewal: one route for all protocols I also added a way to reload specific SSL certificates by specifying the port number ## What remains - [ ] Documentation - [ ] Integration tests -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] vttranlina commented on a diff in pull request #1572: DeletedMessagesVault API - support limit query
vttranlina commented on code in PR #1572: URL: https://github.com/apache/james-project/pull/1572#discussion_r1204951996 ## mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/dto/query/QueryDTO.java: ## @@ -65,6 +67,13 @@ public List getCriteria() { return criteria; } + +@JsonGetter("limit") +public Long getLimitAsLong() { +return limit.orElse(null); +} + +@JsonIgnore Review Comment: Can you explain more? `@JsonIgnore` just for ignoring the `Optional limit` > Add the JDK 8 Jackson Module Your mean is `new ObjectMapper().registerModule(new Jdk8Module());` ? , the `QueryElementSerializer` already receives the `ObjectMapper` bean in constructors, I don't think we should modify the bean -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] vttranlina commented on a diff in pull request #1572: DeletedMessagesVault API - support limit query
vttranlina commented on code in PR #1572: URL: https://github.com/apache/james-project/pull/1572#discussion_r1204951996 ## mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/dto/query/QueryDTO.java: ## @@ -65,6 +67,13 @@ public List getCriteria() { return criteria; } + +@JsonGetter("limit") +public Long getLimitAsLong() { +return limit.orElse(null); +} + +@JsonIgnore Review Comment: Can you explain more? `@JsonIgnore` just for ignoring the `Optional limit` > Add the JDK 8 Jackson Module Your mean is `new ObjectMapper().registerModule(new Jdk8Module());` ? , the `QueryElementSerializer` already receives the `ObjectMapper` bean in constructors, I don't think we should modify the bean -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] chibenwa commented on a diff in pull request #1572: DeletedMessagesVault API - support limit query
chibenwa commented on code in PR #1572: URL: https://github.com/apache/james-project/pull/1572#discussion_r1204904552 ## mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/dto/query/QueryDTO.java: ## @@ -65,6 +67,13 @@ public List getCriteria() { return criteria; } + +@JsonGetter("limit") +public Long getLimitAsLong() { +return limit.orElse(null); +} + +@JsonIgnore Review Comment: Add the JDK 8 Jackson Module to the serializer instead? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-site] branch asf-staging updated: Site checkin for project Apache James: Jenkins Tools
This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-staging in repository https://gitbox.apache.org/repos/asf/james-site.git The following commit(s) were added to refs/heads/asf-staging by this push: new a9c33b4f6 Site checkin for project Apache James: Jenkins Tools a9c33b4f6 is described below commit a9c33b4f6c3d684f464043d2a7daab012952f7ab Author: jenkins AuthorDate: Wed May 24 10:19:07 2023 + Site checkin for project Apache James: Jenkins Tools --- sitemap-james-project.xml | 92 +++ sitemap-james-site.xml| 4 +-- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/sitemap-james-project.xml b/sitemap-james-project.xml index b5d8070db..e7a82ecf2 100644 --- a/sitemap-james-project.xml +++ b/sitemap-james-project.xml @@ -2,186 +2,186 @@ http://www.sitemaps.org/schemas/sitemap/0.9;> https://james.apache.org/james-project/3.7.4/community/contributing.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/community/download.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/community/guidelines.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/community/index.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/community/mailing-lists.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/community/release.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/community/support.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/community/website.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/configuration.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/glossary.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/index.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/mail/index.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/messages/imf.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/messages/index.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/messages/mime.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/processing/index.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/protocols/esmtp.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/protocols/imap.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/protocols/index.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/protocols/jmap.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/protocols/lmtp.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/protocols/pop.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/protocols/smtp.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/storage/index.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/storage/mailbox.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/storage/users.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/concepts/user/index.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/customization/index.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/development/deployment-tests.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/development/index.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z https://james.apache.org/james-project/3.7.4/development/logging.html -2023-05-24T06:03:16.724Z +2023-05-24T10:17:48.140Z
[GitHub] [james-project] chibenwa commented on a diff in pull request #1572: DeletedMessagesVault API - support limit query
chibenwa commented on code in PR #1572: URL: https://github.com/apache/james-project/pull/1572#discussion_r1203731458 ## mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/dto/query/QueryDTO.java: ## @@ -36,22 +35,22 @@ public class QueryDTO implements QueryElement { @VisibleForTesting static QueryDTO and(QueryElement... queryElements) { -return new QueryDTO(Combinator.AND.getValue(), ImmutableList.copyOf(queryElements), Optional.empty()); +return new QueryDTO(Combinator.AND.getValue(), ImmutableList.copyOf(queryElements), null); Review Comment: Optionals are better than null for representing absence of something... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] chibenwa commented on a diff in pull request #1572: DeletedMessagesVault API - support limit query
chibenwa commented on code in PR #1572: URL: https://github.com/apache/james-project/pull/1572#discussion_r1203730943 ## mailbox/plugin/deleted-messages-vault/src/main/java/org/apache/james/vault/dto/query/QueryDTO.java: ## @@ -36,22 +35,22 @@ public class QueryDTO implements QueryElement { @VisibleForTesting static QueryDTO and(QueryElement... queryElements) { -return new QueryDTO(Combinator.AND.getValue(), ImmutableList.copyOf(queryElements), Optional.empty()); +return new QueryDTO(Combinator.AND.getValue(), ImmutableList.copyOf(queryElements), null); } @VisibleForTesting static QueryDTO and(Long limit, QueryElement... queryElements) { -return new QueryDTO(Combinator.AND.getValue(), ImmutableList.copyOf(queryElements), Optional.ofNullable(limit)); +return new QueryDTO(Combinator.AND.getValue(), ImmutableList.copyOf(queryElements), limit); } private final String combinator; private final List criteria; -private final Optional limit; +private final Long limit; Review Comment: Why get rid of the optional? Sounds like a "regression" to me... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] Arsnael commented on pull request #1569: Few delete user data tasks steps
Arsnael commented on PR #1569: URL: https://github.com/apache/james-project/pull/1569#issuecomment-1560621650 Needs a rebase -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] chibenwa commented on pull request #1572: DeletedMessagesVault API - support limit query
chibenwa commented on PR #1572: URL: https://github.com/apache/james-project/pull/1572#issuecomment-1560582761 ![Screenshot from 2023-05-24 14-20-14](https://github.com/apache/james-project/assets/6928740/f960ff18-adde-449c-bfd8-f369f8f650f5) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 04/06: JAMES-3909 Webadmin route for user data deletion
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 42dee87a6d8a8f083283d9956a20b142e5463e8d Author: Quan Tran AuthorDate: Thu May 18 16:51:56 2023 +0700 JAMES-3909 Webadmin route for user data deletion Co-authored-by: Benoit Tellier --- .../webadmin/routes/DeleteUserDataRoutes.java | 84 +++ .../webadmin/routes/DeleteUserDataRoutesTest.java | 278 + 2 files changed, 362 insertions(+) diff --git a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DeleteUserDataRoutes.java b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DeleteUserDataRoutes.java new file mode 100644 index 00..f581ed7127 --- /dev/null +++ b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/DeleteUserDataRoutes.java @@ -0,0 +1,84 @@ +/ + * 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.webadmin.routes; + +import java.util.Optional; + +import javax.inject.Inject; + +import org.apache.james.core.Username; +import org.apache.james.task.TaskManager; +import org.apache.james.user.api.DeleteUserDataTaskStep.StepName; +import org.apache.james.user.api.UsersRepository; +import org.apache.james.webadmin.Routes; +import org.apache.james.webadmin.service.DeleteUserDataService; +import org.apache.james.webadmin.service.DeleteUserDataTask; +import org.apache.james.webadmin.tasks.TaskFromRequestRegistry; +import org.apache.james.webadmin.tasks.TaskRegistrationKey; +import org.apache.james.webadmin.utils.JsonTransformer; + +import com.google.common.base.Preconditions; + +import spark.Route; +import spark.Service; + +public class DeleteUserDataRoutes implements Routes { +private static final String USER_PATH_PARAM = ":username"; +private static final String ROOT_PATH = "/users/" + USER_PATH_PARAM; +private static final TaskRegistrationKey DELETE_USER_DATA = TaskRegistrationKey.of("deleteData"); + +private final UsersRepository usersRepository; +private final DeleteUserDataService service; +private final TaskManager taskManager; +private final JsonTransformer jsonTransformer; + +@Inject +DeleteUserDataRoutes(UsersRepository usersRepository, DeleteUserDataService service, TaskManager taskManager, JsonTransformer jsonTransformer) { +this.usersRepository = usersRepository; +this.service = service; +this.taskManager = taskManager; +this.jsonTransformer = jsonTransformer; +} + +@Override +public String getBasePath() { +return ROOT_PATH; +} + +@Override +public void define(Service service) { +service.post(ROOT_PATH, deleteUserData(), jsonTransformer); +} + +public Route deleteUserData() { +return TaskFromRequestRegistry.builder() +.parameterName("action") +.register(DELETE_USER_DATA, request -> { +Username username = Username.of(request.params(USER_PATH_PARAM)); + + Preconditions.checkArgument(usersRepository.contains(username), "'username' parameter should be an existing user"); + +Optional fromStep = Optional.ofNullable(request.queryParams("fromStep")).map(StepName::new); + +return new DeleteUserDataTask(service, username, fromStep); +}) +.buildAsRoute(taskManager); +} +} diff --git a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DeleteUserDataRoutesTest.java b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DeleteUserDataRoutesTest.java new file mode 100644 index
[james-project] branch master updated (34f74b9e67 -> cfdf2aeeda)
This is an automated email from the ASF dual-hosted git repository. btellier pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git from 34f74b9e67 [ADR] Fix typo in ADR-66 (#1567) new 23842d4511 JAMES-3909 DeleteUserDataTaskStep interface new 71d438aa8c JAMES-3909 Service for delete user data new 6d3443116e JAMES-3909 Task for delete user data new 42dee87a6d JAMES-3909 Webadmin route for user data deletion new eafbb9d008 JAMES-3909 Guice bindings for delete user data routes new cfdf2aeeda JAMES-3909 Documentation for user data deletion webadmin routes The 6 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../docs/modules/ROOT/pages/operate/webadmin.adoc | 51 + .../main/java/org/apache/james/CoreDataModule.java | 2 + .../james/modules/server/DataRoutesModules.java| 21 ...geTaskStep.java => DeleteUserDataTaskStep.java} | 4 +- ...ChangeRoutes.java => DeleteUserDataRoutes.java} | 40 +++ ...angeService.java => DeleteUserDataService.java} | 38 +++ ...nameChangeTask.java => DeleteUserDataTask.java} | 51 - ...eleteUserDataTaskAdditionalInformationDTO.java} | 44 ...angeTaskDTO.java => DeleteUserDataTaskDTO.java} | 45 ...utesTest.java => DeleteUserDataRoutesTest.java} | 116 ++--- ...va => DeleteUserDataTaskSerializationTest.java} | 83 +++ src/site/markdown/server/manage-webadmin.md| 53 ++ 12 files changed, 316 insertions(+), 232 deletions(-) copy server/data/data-api/src/main/java/org/apache/james/user/api/{UsernameChangeTaskStep.java => DeleteUserDataTaskStep.java} (94%) copy server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/routes/{UsernameChangeRoutes.java => DeleteUserDataRoutes.java} (59%) copy server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/{UsernameChangeService.java => DeleteUserDataService.java} (77%) copy server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/{UsernameChangeTask.java => DeleteUserDataTask.java} (66%) copy server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/{UsernameChangeTaskAdditionalInformationDTO.java => DeleteUserDataTaskAdditionalInformationDTO.java} (72%) copy server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/{UsernameChangeTaskDTO.java => DeleteUserDataTaskDTO.java} (62%) copy server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/{UsernameChangeRoutesTest.java => DeleteUserDataRoutesTest.java} (66%) copy server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/service/{UsernameChangeTaskSerializationTest.java => DeleteUserDataTaskSerializationTest.java} (55%) - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 03/06: JAMES-3909 Task for delete user data
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 6d3443116e22d44cc789a5228a3b1772b2c9a187 Author: Quan Tran AuthorDate: Thu May 18 15:10:37 2023 +0700 JAMES-3909 Task for delete user data Simple task wrapper around the service Co-authored-by: Benoit Tellier --- .../james/webadmin/service/DeleteUserDataTask.java | 108 ...DeleteUserDataTaskAdditionalInformationDTO.java | 98 +++ .../webadmin/service/DeleteUserDataTaskDTO.java| 78 .../DeleteUserDataTaskSerializationTest.java | 136 + 4 files changed, 420 insertions(+) diff --git a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUserDataTask.java b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUserDataTask.java new file mode 100644 index 00..2f068eb418 --- /dev/null +++ b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUserDataTask.java @@ -0,0 +1,108 @@ +/ + * 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.webadmin.service; + +import java.time.Clock; +import java.time.Instant; +import java.util.Map; +import java.util.Optional; + +import org.apache.james.core.Username; +import org.apache.james.task.Task; +import org.apache.james.task.TaskExecutionDetails; +import org.apache.james.task.TaskType; +import org.apache.james.user.api.DeleteUserDataTaskStep.StepName; + +import reactor.core.publisher.Mono; + +public class DeleteUserDataTask implements Task { +static final TaskType TYPE = TaskType.of("DeleteUserDataTask"); + +public static class AdditionalInformation implements TaskExecutionDetails.AdditionalInformation { +private final Instant timestamp; +private final Username username; +private final Map status; +private final Optional fromStep; + +public AdditionalInformation(Instant timestamp, Username username, Map status, Optional fromStep) { +this.timestamp = timestamp; +this.username = username; +this.status = status; +this.fromStep = fromStep; +} + +public Optional getFromStep() { +return fromStep; +} + +public Username getUsername() { +return username; +} + +public Map getStatus() { +return status; +} + +@Override +public Instant timestamp() { +return timestamp; +} +} + +private final Username username; +private final DeleteUserDataService.Performer performer; +private final Optional fromStep; + +public DeleteUserDataTask(DeleteUserDataService service, Username username, Optional fromStep) { +this.username = username; +this.performer = service.performer(fromStep); +this.fromStep = fromStep; +} + + +@Override +public Result run() { +return performer.deleteUserData(username) +.thenReturn(Result.COMPLETED) +.onErrorResume(e -> { +LOGGER.error("Error while deleting data of the user {}", username.asString(), e); +return Mono.just(Result.PARTIAL); +}) +.block(); +} + +@Override +public TaskType type() { +return TYPE; +} + +@Override +public Optional details() { +return Optional.of(new AdditionalInformation(Clock.systemUTC().instant(), username, performer.getStatus().getStates(), fromStep)); +} + +public Username getUsername() { +return username; +} + +public Optional getFromStep() { +
[james-project] 05/06: JAMES-3909 Guice bindings for delete user data routes
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 eafbb9d00890dbe67ba77b1d89d75b1404223a7b Author: Quan Tran AuthorDate: Fri May 19 16:31:33 2023 +0700 JAMES-3909 Guice bindings for delete user data routes --- .../main/java/org/apache/james/CoreDataModule.java | 2 ++ .../james/modules/server/DataRoutesModules.java | 21 + 2 files changed, 23 insertions(+) diff --git a/server/container/guice/common/src/main/java/org/apache/james/CoreDataModule.java b/server/container/guice/common/src/main/java/org/apache/james/CoreDataModule.java index 7ee574f0b6..ae54975465 100644 --- a/server/container/guice/common/src/main/java/org/apache/james/CoreDataModule.java +++ b/server/container/guice/common/src/main/java/org/apache/james/CoreDataModule.java @@ -25,6 +25,7 @@ import org.apache.commons.configuration2.ex.ConfigurationException; import org.apache.james.domainlist.lib.DomainListConfiguration; import org.apache.james.rrt.ForwardUsernameChangeTaskStep; import org.apache.james.server.core.configuration.ConfigurationProvider; +import org.apache.james.user.api.DeleteUserDataTaskStep; import org.apache.james.user.api.UsernameChangeTaskStep; import com.google.inject.AbstractModule; @@ -39,6 +40,7 @@ public class CoreDataModule extends AbstractModule { Multibinder.newSetBinder(binder(), UserEntityValidator.class).addBinding().to(RecipientRewriteTableUserEntityValidator.class); Multibinder.newSetBinder(binder(), UsernameChangeTaskStep.class).addBinding().to(ForwardUsernameChangeTaskStep.class); +Multibinder.newSetBinder(binder(), DeleteUserDataTaskStep.class); } @Provides diff --git a/server/container/guice/protocols/webadmin-data/src/main/java/org/apache/james/modules/server/DataRoutesModules.java b/server/container/guice/protocols/webadmin-data/src/main/java/org/apache/james/modules/server/DataRoutesModules.java index fd64948fd5..5b3addf079 100644 --- a/server/container/guice/protocols/webadmin-data/src/main/java/org/apache/james/modules/server/DataRoutesModules.java +++ b/server/container/guice/protocols/webadmin-data/src/main/java/org/apache/james/modules/server/DataRoutesModules.java @@ -31,6 +31,7 @@ import org.apache.james.webadmin.dto.MappingSourceModule; import org.apache.james.webadmin.mdc.RequestLogger; import org.apache.james.webadmin.routes.AddressMappingRoutes; import org.apache.james.webadmin.routes.AliasRoutes; +import org.apache.james.webadmin.routes.DeleteUserDataRoutes; import org.apache.james.webadmin.routes.DomainMappingsRoutes; import org.apache.james.webadmin.routes.DomainsRoutes; import org.apache.james.webadmin.routes.ForwardRoutes; @@ -40,6 +41,9 @@ import org.apache.james.webadmin.routes.RegexMappingRoutes; import org.apache.james.webadmin.routes.UserCreationRequestLogger; import org.apache.james.webadmin.routes.UserRoutes; import org.apache.james.webadmin.routes.UsernameChangeRoutes; +import org.apache.james.webadmin.service.DeleteUserDataService; +import org.apache.james.webadmin.service.DeleteUserDataTaskAdditionalInformationDTO; +import org.apache.james.webadmin.service.DeleteUserDataTaskDTO; import org.apache.james.webadmin.service.UsernameChangeService; import org.apache.james.webadmin.service.UsernameChangeTaskAdditionalInformationDTO; import org.apache.james.webadmin.service.UsernameChangeTaskDTO; @@ -65,6 +69,7 @@ public class DataRoutesModules extends AbstractModule { routesMultibinder.addBinding().to(RegexMappingRoutes.class); routesMultibinder.addBinding().to(UserRoutes.class); routesMultibinder.addBinding().to(UsernameChangeRoutes.class); +routesMultibinder.addBinding().to(DeleteUserDataRoutes.class); Multibinder jsonTransformerModuleMultibinder = Multibinder.newSetBinder(binder(), JsonTransformerModule.class); jsonTransformerModuleMultibinder.addBinding().to(MappingSourceModule.class); @@ -87,4 +92,20 @@ public class DataRoutesModules extends AbstractModule { public AdditionalInformationDTOModule webAdminUsernameChangeTaskAdditionalInformationDTO() { return UsernameChangeTaskAdditionalInformationDTO.module(); } + +@ProvidesIntoSet +public TaskDTOModule deleteUserDataTaskDTO(DeleteUserDataService service) { +return DeleteUserDataTaskDTO.module(service); +} + +@ProvidesIntoSet +public AdditionalInformationDTOModule deleteUserDataTaskAdditionalInformationDTO() { +return DeleteUserDataTaskAdditionalInformationDTO.module(); +} + +@Named(DTOModuleInjections.WEBADMIN_DTO) +@ProvidesIntoSet +public AdditionalInformationDTOModule webAdminDeleteUserDataTaskAdditionalInformationDTO() { +return DeleteUserDataTaskAdditionalInformationDTO.module(); +} }
[james-project] 06/06: JAMES-3909 Documentation for user data deletion webadmin routes
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 cfdf2aeeda887c27d0e14f625216c5a25c0f9a85 Author: Quan Tran AuthorDate: Fri May 19 16:45:15 2023 +0700 JAMES-3909 Documentation for user data deletion webadmin routes --- .../docs/modules/ROOT/pages/operate/webadmin.adoc | 51 + src/site/markdown/server/manage-webadmin.md| 53 ++ 2 files changed, 104 insertions(+) diff --git a/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc b/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc index bf37c8343f..1a343c7d30 100644 --- a/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc +++ b/server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc @@ -674,6 +674,57 @@ The scheduled task will have the following type `UsernameChangeTask` and the fol } +Valid status includes: + + - `SKIPPED`: bypassed via `fromStep` setting + - `WAITING`: Awaits execution + - `IN_PROGRESS`: Currently executed + - `FAILED`: Error encountered while executing this step. Check the logs. + - `ABORTED`: Won't be executed because of previous step failures. + +=== Delete data of a user + + +curl -XPOST http://ip:port/users/usernameToBeUsed?action=deleteData + + +Would create a task that deletes data of the user. + +link:#_endpoints_returning_a_task[More details about endpoints returning a task]. + +Implemented deletion steps are: + + - `RecipientRewriteTableUserDeletionTaskStep`: deletes all rewriting rules related to this user. + - `FilterUserDeletionTaskStep`: deletes all filters belonging to the user. + - `DelegationUserDeletionTaskStep`: deletes all delegations from / to the user. + - `MailboxUserDeletionTaskStep`: deletes mailboxes of this user, all ACLs of this user, as well as his subscriptions. + - `WebPushUserDeletionTaskStep`: deletes push data registered for this user. + - `IdentityUserDeletionTaskStep`: deletes identities registered for this user. + - `VacationUserDeletionTaskStep`: deletes vacations registered for this user. + +Response codes: + +* 201: Success. Corresponding task id is returned. +* 400: Error in the request. Details can be found in the reported error. + +The `fromStep` query parameter allows skipping previous steps, allowing to resume the user data deletion from a failed step. + +The scheduled task will have the following type `DeleteUserDataTask` and the following `additionalInformation`: + + +{ +"type": "DeleteUserDataTask", +"username": "jessy.jo...@domain.tld", +"status": { +"A": "DONE", +"B": "FAILED", +"C": "ABORTED" +}, +"fromStep": null, +"timestamp": "2023-02-17T02:54:01.246477Z" +} + + Valid status includes: - `SKIPPED`: bypassed via `fromStep` setting diff --git a/src/site/markdown/server/manage-webadmin.md b/src/site/markdown/server/manage-webadmin.md index 4f59df86d3..329cd488ad 100644 --- a/src/site/markdown/server/manage-webadmin.md +++ b/src/site/markdown/server/manage-webadmin.md @@ -310,6 +310,8 @@ Response codes: - [Deleting a user](#Deleting_a_user) - [Retrieving the user list](#Retrieving_the_user_list) - [Retrieving the list of allowed `From` headers for a given user](Retrieving_the_list_of_allowed_From_headers_for_a_given_user) + - [Change a username](#change-a-username) + - [Delete data of a user](#delete-data-of-a-user) ### Create a user @@ -515,6 +517,57 @@ The scheduled task will have the following type `UsernameChangeTask` and the fol } ``` +Valid status includes: + + - `SKIPPED`: bypassed via `fromStep` setting + - `WAITING`: Awaits execution + - `IN_PROGRESS`: Currently executed + - `FAILED`: Error encountered while executing this step. Check the logs. + - `ABORTED`: Won't be executed because of previous step failures. + +### Delete data of a user + +``` +curl -XPOST http://ip:port/users/usernameToBeUsed?action=deleteData +``` + +Would create a task that deletes data of the user. + +[More details about endpoints returning a task](#_endpoints_returning_a_task). + +Implemented deletion steps are: + +- `RecipientRewriteTableUserDeletionTaskStep`: deletes all rewriting rules related to this user. +- `FilterUserDeletionTaskStep`: deletes all filters belonging to the user. +- `DelegationUserDeletionTaskStep`: deletes all delegations from / to the user. +- `MailboxUserDeletionTaskStep`: deletes mailboxes of this user, all ACLs of this user, as well as his subscriptions. +- `WebPushUserDeletionTaskStep`: deletes push data registered for this user. +- `IdentityUserDeletionTaskStep`: deletes identities registered for this user. +- `VacationUserDeletionTaskStep`: deletes vacations registered for this user. + +Response codes: + +* 201: Success. Corresponding task id is
[james-project] 01/06: JAMES-3909 DeleteUserDataTaskStep interface
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 23842d4511599f492a77c6e73524d084cd1d592a Author: Quan Tran AuthorDate: Thu May 18 13:25:32 2023 +0700 JAMES-3909 DeleteUserDataTaskStep interface Co-authored-by: Benoit Tellier --- .../james/user/api/DeleteUserDataTaskStep.java | 60 ++ 1 file changed, 60 insertions(+) diff --git a/server/data/data-api/src/main/java/org/apache/james/user/api/DeleteUserDataTaskStep.java b/server/data/data-api/src/main/java/org/apache/james/user/api/DeleteUserDataTaskStep.java new file mode 100644 index 00..5f72d3806a --- /dev/null +++ b/server/data/data-api/src/main/java/org/apache/james/user/api/DeleteUserDataTaskStep.java @@ -0,0 +1,60 @@ +/ + * 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.user.api; + +import java.util.Objects; + +import org.apache.james.core.Username; +import org.reactivestreams.Publisher; + +public interface DeleteUserDataTaskStep { +class StepName { +private final String value; + +public StepName(String value) { +this.value = value; +} + +public String asString() { +return value; +} + +@Override +public final boolean equals(Object o) { +if (o instanceof StepName) { +StepName other = (StepName) o; + +return Objects.equals(this.value, other.value); +} +return false; +} + +@Override +public final int hashCode() { +return Objects.hash(value); +} +} + +StepName name(); + +int priority(); + +Publisher deleteUserData(Username username); +} - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[GitHub] [james-project] chibenwa merged pull request #1566: JAMES-3909 Skeleton code for user data deletion
chibenwa merged PR #1566: URL: https://github.com/apache/james-project/pull/1566 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org
[james-project] 02/06: JAMES-3909 Service for delete user data
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 71d438aa8c91b5f181ef8982cfa30ca92522fa18 Author: Quan Tran AuthorDate: Thu May 18 13:36:56 2023 +0700 JAMES-3909 Service for delete user data Plug steps together, running them one after theother and provides ordering of steps, execution tacking. Stops at first failed steps and aborts the following steps. Co-authored-by: Benoit Tellier --- .../webadmin/service/DeleteUserDataService.java| 146 + 1 file changed, 146 insertions(+) diff --git a/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUserDataService.java b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUserDataService.java new file mode 100644 index 00..2bd572b68c --- /dev/null +++ b/server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUserDataService.java @@ -0,0 +1,146 @@ +/ + * 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.webadmin.service; + +import java.util.Comparator; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +import javax.inject.Inject; + +import org.apache.james.core.Username; +import org.apache.james.user.api.DeleteUserDataTaskStep; +import org.apache.james.user.api.DeleteUserDataTaskStep.StepName; + +import com.google.common.collect.ImmutableMap; + +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public class DeleteUserDataService { +public enum StepState { +WAITING, +IN_PROGRESS, +DONE, +FAILED, +ABORTED, +SKIPPED +} + +public static class DeleteUserDataStatus { +private final Map states; + +public DeleteUserDataStatus(Set steps) { +states = new ConcurrentHashMap<>(steps.stream() + .collect(ImmutableMap.toImmutableMap(DeleteUserDataTaskStep::name, any -> StepState.WAITING))); +} + +public void beginStep(StepName step) { +states.put(step, StepState.IN_PROGRESS); +} + +public void endStep(StepName step) { +states.put(step, StepState.DONE); +} + +public void failedStep(StepName step) { +states.put(step, StepState.FAILED); +} + +public void abortStep(StepName step) { +states.put(step, StepState.ABORTED); +} + +public void skipStep(StepName step) { +states.put(step, StepState.SKIPPED); +} + +public void abort() { +states.entrySet() +.stream() +.filter(entry -> entry.getValue() == StepState.WAITING || entry.getValue() == StepState.IN_PROGRESS) +.forEach(entry -> abortStep(entry.getKey())); +} + +public Map getStates() { +return ImmutableMap.copyOf(states); +} +} + +public static class Performer { +private final Set steps; +private final DeleteUserDataStatus status; +private final Optional correspondingPriority; + +public Performer(Set steps, DeleteUserDataStatus status, Optional fromStep) { +this.steps = steps; +this.status = status; +this.correspondingPriority = fromStep.map(this::correspondingPriority); +} + +public Mono deleteUserData(Username username) { +correspondingPriority.ifPresent(priority -> steps.stream() +.filter(step -> step.priority() < priority) +.forEach(step ->