From b287b69bf176e747163d62faa04dd317f412d133 Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Mon, 24 Apr 2023 18:38:44 +0200 Subject: [PATCH] alternative to emailaddress-remote --- .../src/de/hsadmin/remote/EMailRemote.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/hsarback/src/de/hsadmin/remote/EMailRemote.java b/hsarback/src/de/hsadmin/remote/EMailRemote.java index 96d2d0d..cc6d104 100644 --- a/hsarback/src/de/hsadmin/remote/EMailRemote.java +++ b/hsarback/src/de/hsadmin/remote/EMailRemote.java @@ -108,10 +108,32 @@ public class EMailRemote extends AbstractRemote { @Override protected void regularizeKeys(Map whereParams) { + if (whereParams.containsKey("name")) { + String name = whereParams.get("name"); + String domain = null; + String fulldomain = null; + String subdomain = null; + String localpart = null; + String[] nameParts = name.split("@"); + if (nameParts.length == 2) { + localpart = nameParts[0]; + fulldomain = nameParts[1]; + String[] fulldomainParts = fulldomain.split("\\:"); + if (fulldomainParts.length == 2) { + subdomain = fulldomainParts[0]; + domain = fulldomainParts[1]; + } else { + domain = fulldomain; + } + } + whereParams.remove("name"); + if (localpart != null) whereParams.put("localpart", localpart); + if (subdomain != null) whereParams.put("subdomain", subdomain); + if (domain != null) whereParams.put("domain", domain); + } replaceKey(whereParams, "domain", "domain.name"); replaceKey(whereParams, "pac", "domain.user.pac.name"); replaceKey(whereParams, "admin", "domain.user.name"); - whereParams.remove("name"); } @Override