]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/ldap/nature/SimpleUserNatureMapper.java
Improve Security
[lgpl/argeo-commons.git] / security / runtime / org.argeo.security.core / src / main / java / org / argeo / security / ldap / nature / SimpleUserNatureMapper.java
index bbca1e10c5ccb40b37eec366034142e91be0f872..681c5174a65b4029c3e0782fb597d29e07d88835 100644 (file)
@@ -23,6 +23,9 @@ import org.springframework.ldap.core.DirContextAdapter;
 import org.springframework.ldap.core.DirContextOperations;
 
 public class SimpleUserNatureMapper implements UserNatureMapper {
+       public String getName() {
+               return SimpleUserNature.TYPE;
+       }
 
        public UserNature mapUserInfoFromContext(DirContextOperations ctx) {
                SimpleUserNature nature = new SimpleUserNature();
@@ -36,12 +39,13 @@ public class SimpleUserNatureMapper implements UserNatureMapper {
        public void mapUserInfoToContext(UserNature userInfoArg,
                        DirContextAdapter ctx) {
                SimpleUserNature nature = (SimpleUserNature) userInfoArg;
-               ctx.setAttributeValue("cn", nature.getFirstName() + " "
-                               + nature.getLastName());
+               ctx.setAttributeValue("cn",
+                               nature.getFirstName() + " " + nature.getLastName());
                ctx.setAttributeValue("sn", nature.getLastName());
                ctx.setAttributeValue("givenName", nature.getFirstName());
                ctx.setAttributeValue("mail", nature.getEmail());
-               if (nature.getDescription() != null) {
+               if (nature.getDescription() != null
+                               && !nature.getDescription().equals("")) {
                        ctx.setAttributeValue("description", nature.getDescription());
                }
        }