boolean canLogIn = "true".equals(inputVar.get("canLogIn"));
boolean requireCertificate = "true".equals(inputVar.get("requireCertificate"));
boolean selfRegistered = "true".equals(inputVar.get("selfRegistered"));
try {
Group group = Group.find(context, Integer.parseInt(ref.getId()));
if (group != null) {
if (EPerson.findByEmail(context, email) == null) {
EPerson ePerson = EPerson.create(context);
if (ePerson != null) {
result = String.valueOf(ePerson.getID());
ePerson.setEmail(email);
ePerson.setFirstName(firstName);
ePerson.setLastName(lastName);
if (password != null && !"".equals(password)) ePerson.setPassword(password);
ePerson.setMetadata("phone", phone);
ePerson.setNetid(netId);
ePerson.setLanguage(language);
ePerson.setCanLogIn(canLogIn);
ePerson.setRequireCertificate(requireCertificate);
ePerson.setSelfRegistered(selfRegistered);
ePerson.update();
group.addMember(ePerson);
group.update();
} else {
throw new EntityException("Internal server error", "Could not create ePerson", 500);
}
} else {
throw new EntityException("Data error", "Duplicated ePerson", 500);