external email in description
This commit is contained in:
parent
e06cb3dffb
commit
9e036e98b7
@ -4,14 +4,12 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.jalin.ldapadmin.ldap.LDAPConfig;
|
||||
import de.jalin.ldapadmin.ldap.PasswordValidator;
|
||||
import de.jalin.ldapadmin.ldap.SimplePasswordException;
|
||||
|
||||
public class User implements Serializable, LDAPBean {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final String INTERNAL_EMAILDOMAINS = LDAPConfig.getConfig().getSmtpInternalDomains();
|
||||
|
||||
private String dn;
|
||||
private String login;
|
||||
@ -92,22 +90,6 @@ public class User implements Serializable, LDAPBean {
|
||||
return emailExternal;
|
||||
}
|
||||
|
||||
public void setEmailAddresses(List<String> emails) {
|
||||
if (emails != null) {
|
||||
for (final String email : emails) {
|
||||
final String[] parts = email.split("@");
|
||||
if (parts.length == 2) {
|
||||
final String emailDomain = parts[1];
|
||||
if (INTERNAL_EMAILDOMAINS.contains(emailDomain)) {
|
||||
setEmailInternal(email);
|
||||
} else {
|
||||
setEmailExternal(email);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setEmailExternal(String email) {
|
||||
this.emailExternal = email;
|
||||
}
|
||||
|
@ -30,7 +30,8 @@ public class UsersDAO {
|
||||
final User usr = new User();
|
||||
usr.setFirstname(session.getStringValue(attribs, "givenName"));
|
||||
usr.setLastname(session.getStringValue(attribs, "sn"));
|
||||
usr.setEmailAddresses(session.getListOfValues(attribs, "mail"));
|
||||
usr.setEmailInternal(session.getStringValue(attribs, "mail"));
|
||||
usr.setEmailExternal(session.getStringValue(attribs, "description"));
|
||||
usr.setLogin(session.getStringValue(attribs, "uid"));
|
||||
usr.setPhone(session.getStringValue(attribs, "telephoneNumber"));
|
||||
usr.setMobile(session.getStringValue(attribs, "mobile"));
|
||||
@ -105,7 +106,8 @@ public class UsersDAO {
|
||||
final User usr = new User();
|
||||
usr.setFirstname(session.getStringValue(attribs, "givenName"));
|
||||
usr.setLastname(session.getStringValue(attribs, "sn"));
|
||||
usr.setEmailAddresses(session.getListOfValues(attribs, "mail"));
|
||||
usr.setEmailExternal(session.getStringValue(attribs, "description"));
|
||||
usr.setEmailInternal(session.getStringValue(attribs, "mail"));
|
||||
usr.setLogin(session.getStringValue(attribs, "uid"));
|
||||
usr.setPhone(session.getStringValue(attribs, "telephoneNumber"));
|
||||
usr.setMobile(session.getStringValue(attribs, "mobile"));
|
||||
@ -130,7 +132,7 @@ public class UsersDAO {
|
||||
}
|
||||
final String emailExternal = usr.getEmailExternal();
|
||||
if (hasValue(emailExternal)) {
|
||||
emailAdressList.add(emailExternal);
|
||||
addStringAttrUpdate(updates, attribs, "description", emailExternal);
|
||||
}
|
||||
addMultiValueAttrUpdate(updates, attribs, "mail", emailAdressList);
|
||||
addStringAttrUpdate(updates, attribs, "givenName", usr.getFirstname());
|
||||
|
Loading…
Reference in New Issue
Block a user