Skip to content

Commit

Permalink
Populate attributes to track creation/modification of users #1271
Browse files Browse the repository at this point in the history
  • Loading branch information
jgomer2001 committed Mar 11, 2020
1 parent e5995b8 commit cdaecb0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions common/src/main/java/org/gluu/oxauth/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public String getUserInum(String userId) {
}

public User updateUser(User user) {
user.setUpdatedAt(new Date());
return ldapEntryManager.merge(user);
}

Expand All @@ -134,7 +135,8 @@ public User addDefaultUser(String uid) {
if ((personCustomObjectClassList != null) && !personCustomObjectClassList.isEmpty()) {
user.setCustomObjectClasses(personCustomObjectClassList.toArray(new String[personCustomObjectClassList.size()]));
}


user.setCreatedAt(new Date());
ldapEntryManager.persist(user);

return getUser(uid);
Expand All @@ -153,7 +155,7 @@ public User addUser(User user, boolean active) {

List<String> personCustomObjectClassList = appConfiguration.getPersonCustomObjectClassList();
if ((personCustomObjectClassList != null) && !personCustomObjectClassList.isEmpty()) {
Set<String> allObjectClasses = new HashSet<String>();
Set<String> allObjectClasses = new HashSet<>();
allObjectClasses.addAll(personCustomObjectClassList);

String currentObjectClasses[] = user.getCustomObjectClasses();
Expand All @@ -164,6 +166,7 @@ public User addUser(User user, boolean active) {
user.setCustomObjectClasses(allObjectClasses.toArray(new String[allObjectClasses.size()]));
}

user.setCreatedAt(new Date());
ldapEntryManager.persist(user);

return getUserByDn(user.getDn());
Expand Down

0 comments on commit cdaecb0

Please sign in to comment.