You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by "quantranhong1999 (via GitHub)" <gi...@apache.org> on 2023/05/18 09:57:29 UTC

[GitHub] [james-project] quantranhong1999 opened a new pull request, #1566: JAMES-3909 Skeleton code for user data deletion

quantranhong1999 opened a new pull request, #1566:
URL: https://github.com/apache/james-project/pull/1566

   Scope: Task + Service + Webadmin
   
   TODO: docs, guice binding


-- 
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-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa commented on a diff in pull request #1566: JAMES-3909 Skeleton code for user data deletion

Posted by "chibenwa (via GitHub)" <gi...@apache.org>.
chibenwa commented on code in PR #1566:
URL: https://github.com/apache/james-project/pull/1566#discussion_r1198859130


##########
server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUsersDataOfDomainTask.java:
##########
@@ -0,0 +1,95 @@
+/****************************************************************
+ * 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.Optional;
+
+import org.apache.james.core.Domain;
+import org.apache.james.task.Task;
+import org.apache.james.task.TaskExecutionDetails;
+import org.apache.james.task.TaskType;
+import org.apache.james.user.api.UsersRepository;
+
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+public class DeleteUsersDataOfDomainTask implements Task {
+    static final TaskType TYPE = TaskType.of("DeleteUsersDataOfDomainTask");
+
+    public static class AdditionalInformation implements TaskExecutionDetails.AdditionalInformation {
+        private final Instant timestamp;
+        private final Domain domain;
+
+        public AdditionalInformation(Instant timestamp, Domain domain) {
+            this.timestamp = timestamp;
+            this.domain = domain;
+        }
+
+        public Domain getDomain() {
+            return domain;
+        }
+
+        @Override
+        public Instant timestamp() {
+            return timestamp;
+        }
+    }
+
+    private final Domain domain;
+    private final DeleteUserDataService.Performer performer;
+    private final UsersRepository usersRepository;
+
+    public DeleteUsersDataOfDomainTask(DeleteUserDataService service, Domain domain, UsersRepository usersRepository) {
+        this.domain = domain;
+        this.performer = service.performer(Optional.empty());
+        this.usersRepository = usersRepository;
+    }
+
+    @Override
+    public Result run() {
+        return Flux.from(usersRepository.listReactive())
+            .filter(username -> username.getDomainPart()

Review Comment:
   Ok with not a lot of domains with many users each ( ~ on prem ? )
   
   Not OK for many domains with not a lot of users ( ~ b2c SaaS)
   
   No need to solve this now but maybe we could add a default method into UsersRepository to list users of a domain...
   
   So that later people running into this issue could use it and override this behaviour if needed.



##########
server/protocols/webadmin/webadmin-data/src/main/java/org/apache/james/webadmin/service/DeleteUsersDataOfDomainTask.java:
##########
@@ -0,0 +1,95 @@
+/****************************************************************
+ * 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.Optional;
+
+import org.apache.james.core.Domain;
+import org.apache.james.task.Task;
+import org.apache.james.task.TaskExecutionDetails;
+import org.apache.james.task.TaskType;
+import org.apache.james.user.api.UsersRepository;
+
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+public class DeleteUsersDataOfDomainTask implements Task {
+    static final TaskType TYPE = TaskType.of("DeleteUsersDataOfDomainTask");
+
+    public static class AdditionalInformation implements TaskExecutionDetails.AdditionalInformation {
+        private final Instant timestamp;
+        private final Domain domain;

Review Comment:
   Track the count of failed users, successful users please



##########
server/container/guice/common/src/main/java/org/apache/james/CoreDataModule.java:
##########
@@ -39,6 +40,7 @@ protected void configure() {
         Multibinder.newSetBinder(binder(), UserEntityValidator.class).addBinding().to(RecipientRewriteTableUserEntityValidator.class);
 
         Multibinder.newSetBinder(binder(), UsernameChangeTaskStep.class).addBinding().to(ForwardUsernameChangeTaskStep.class);
+        Multibinder.newSetBinder(binder(), DeleteUserDataTaskStep.class); // TODO do real steps binding when steps are available

Review Comment:
   Can remove the comment IMO



##########
server/apps/distributed-app/docs/modules/ROOT/pages/operate/webadmin.adoc:
##########
@@ -455,6 +455,31 @@ 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}/users?action=deleteData

Review Comment:
   Just 
   
   curl -XPOST http://ip:port/domains/{domainToBeUsed}?action=deleteData
   
   
   ??



-- 
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-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] chibenwa merged pull request #1566: JAMES-3909 Skeleton code for user data deletion

Posted by "chibenwa (via GitHub)" <gi...@apache.org>.
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-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org


[GitHub] [james-project] quantranhong1999 commented on pull request #1566: JAMES-3909 Skeleton code for user data deletion

Posted by "quantranhong1999 (via GitHub)" <gi...@apache.org>.
quantranhong1999 commented on PR #1566:
URL: https://github.com/apache/james-project/pull/1566#issuecomment-1556464314

   Removed the delete all users part (TODO open other PR).


-- 
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-unsubscribe@james.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org