alternative to emailaddress-remote

This commit is contained in:
Peter Hormanns 2023-04-24 18:38:44 +02:00
parent 323d61adcb
commit b287b69bf1

View File

@ -108,10 +108,32 @@ public class EMailRemote extends AbstractRemote {
@Override
protected void regularizeKeys(Map<String, String> 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