return null;
}
// Create the weblounge user
WebloungeUser user = new WebloungeUserImpl(login, site.getIdentifier());
// Standard attributes like first name, name, ...
if (StringUtils.isNotBlank(jpaAccount.getFirstname()))
user.setFirstName(jpaAccount.getFirstname());
if (StringUtils.isNotBlank(jpaAccount.getLastname()))
user.setLastName(jpaAccount.getLastname());
if (StringUtils.isNotBlank(jpaAccount.getEmail()))
user.setEmail(jpaAccount.getEmail());
if (StringUtils.isNotBlank(jpaAccount.getInitials()))
user.setInitials(jpaAccount.getInitials());
// Password
user.addPrivateCredentials(new PasswordImpl(jpaAccount.getPassword(), DigestType.md5));
// Roles
for (JpaRole r : jpaAccount.getRoles()) {
// Make sure weblounge roles get special treatment in order
// to support role inheritance. Other directories will need
// to implement this through a LoginListener implementation
if (Security.SYSTEM_CONTEXT.equals(r.getContext())) {
if (SYSTEMADMIN.getIdentifier().equals(r.getRolename())) {
user.addPublicCredentials(SYSTEMADMIN);
} else if (SITEADMIN.getIdentifier().equals(r.getRolename())) {
user.addPublicCredentials(SITEADMIN);
} else if (PUBLISHER.getIdentifier().equals(r.getRolename())) {
user.addPublicCredentials(PUBLISHER);
} else if (EDITOR.getIdentifier().equals(r.getRolename())) {
user.addPublicCredentials(EDITOR);
} else if (GUEST.getIdentifier().equals(r.getRolename())) {
user.addPublicCredentials(GUEST);
}
} else {
user.addPublicCredentials(new RoleImpl(r.getContext(), r.getRolename()));
}
}
return user;
}