From 611e112d16a21d28fa43d8bf868e5e04a25b1be5 Mon Sep 17 00:00:00 2001
From: srosse <stephane.rosse@frentix.com>
Date: Tue, 19 Mar 2019 08:41:44 +0100
Subject: [PATCH] OO-3974: don't propose new users in deletion process (patch
 S. Clemenz)

---
 .../org/olat/admin/user/delete/service/UserDeletionManager.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/olat/admin/user/delete/service/UserDeletionManager.java b/src/main/java/org/olat/admin/user/delete/service/UserDeletionManager.java
index fbe21c94c35..21e51e0e81e 100644
--- a/src/main/java/org/olat/admin/user/delete/service/UserDeletionManager.java
+++ b/src/main/java/org/olat/admin/user/delete/service/UserDeletionManager.java
@@ -180,7 +180,7 @@ public class UserDeletionManager {
 		StringBuilder sb = new StringBuilder(512);
 		sb.append("select ident from ").append(IdentityImpl.class.getName()).append(" as ident")
 		  .append(" inner join fetch ident.user as user")
-		  .append(" where ident.status=").append(Identity.STATUS_ACTIV).append(" and (ident.lastLogin = null or ident.lastLogin < :lastLogin)")
+		  .append(" where ident.status=").append(Identity.STATUS_ACTIV).append(" and ((ident.lastLogin = null and ident.creationDate < :lastLogin) or ident.lastLogin < :lastLogin)")
 		  .append(" and exists (select orgtomember.key from bgroupmember as orgtomember ")
 		  .append("  inner join organisation as org on (org.group.key=orgtomember.group.key)")
 		  .append("  where orgtomember.identity.key=ident.key and org.key in (:organisationKeys) and orgtomember.role='").append(OrganisationRoles.user).append("')");
-- 
GitLab