use of io.jans.model.GluuStatus in project jans by JanssenProject.
the class UserService method addUser.
public User addUser(User user, boolean active) {
String peopleBaseDN = getPeopleBaseDn();
String inum = inumService.generatePeopleInum();
user.setDn("inum=" + inum + "," + peopleBaseDN);
user.setAttribute("inum", inum, false);
GluuStatus status = active ? GluuStatus.ACTIVE : GluuStatus.REGISTER;
user.setAttribute("jansStatus", status.getValue(), false);
List<String> personCustomObjectClassList = getPersonCustomObjectClassList();
if ((personCustomObjectClassList != null) && !personCustomObjectClassList.isEmpty()) {
Set<String> allObjectClasses = new HashSet<>();
allObjectClasses.addAll(personCustomObjectClassList);
String[] currentObjectClasses = user.getCustomObjectClasses();
if (ArrayHelper.isNotEmpty(currentObjectClasses)) {
allObjectClasses.addAll(Arrays.asList(currentObjectClasses));
}
user.setCustomObjectClasses(allObjectClasses.toArray(new String[allObjectClasses.size()]));
}
user.setCreatedAt(new Date());
persistenceEntryManager.persist(user);
return getUserByDn(user.getDn());
}
Aggregations