mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-06 06:49:53 -06:00
fix: retaining user creation timestamp when importing
closes: #43195 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
committed by
Pedro Igor
parent
e4dc88de13
commit
6f36a02ffe
@@ -974,7 +974,9 @@ public class DefaultExportImportManager implements ExportImportManager {
|
||||
// Import users just to user storage. Don't federate
|
||||
UserModel user = UserStoragePrivateUtil.userLocalStorage(session).addUser(newRealm, userRep.getId(), userRep.getUsername(), false, false);
|
||||
user.setEnabled(userRep.isEnabled() != null && userRep.isEnabled());
|
||||
user.setCreatedTimestamp(userRep.getCreatedTimestamp());
|
||||
if (userRep.getCreatedTimestamp() != null) {
|
||||
user.setCreatedTimestamp(userRep.getCreatedTimestamp());
|
||||
}
|
||||
user.setEmail(userRep.getEmail());
|
||||
if (userRep.isEmailVerified() != null) user.setEmailVerified(userRep.isEmailVerified());
|
||||
user.setFirstName(userRep.getFirstName());
|
||||
|
||||
@@ -165,8 +165,8 @@ public class ExportImportUtil {
|
||||
|
||||
// Test role mappings
|
||||
UserRepresentation admin = findByUsername(realmRsc, "admin");
|
||||
// user without creation timestamp in import
|
||||
Assert.assertNull(admin.getCreatedTimestamp());
|
||||
|
||||
Assert.assertNotNull(admin.getCreatedTimestamp());
|
||||
Set<RoleRepresentation> allRoles = allRoles(realmRsc, admin);
|
||||
Assert.assertEquals(3, allRoles.size());
|
||||
Assert.assertTrue(containsRole(allRoles, findRealmRole(realmRsc, "admin")));
|
||||
|
||||
Reference in New Issue
Block a user