Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-96070 || Add default fields to user builder #343

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ private void updateUser(User user, UserResource userResource, GitHubClient gitHu

private User createUser(UserResource userResource, GitHubClient gitHubClient) {
User user = new User();
String login = normalizeId(userResource.getLogin());
user.setLogin(login);
user.setLogin(normalizeId(userResource.getLogin()));
user.setUuid(UUID.randomUUID());
user.setActive(Boolean.TRUE);

updateUser(user, userResource, gitHubClient);
user.setUserType(UserType.GITHUB);
user.setRole(UserRole.USER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,25 @@ private String validateEmail(String email) {

private User createNewUser(DirContextOperations ctx, Map<String, String> syncAttributes,
String email, String login) {
User newUser = new User();
newUser.setLogin(login);
User user = new User();
user.setLogin(login);
user.setUuid(UUID.randomUUID());
user.setActive(Boolean.TRUE);

String fullName = getFullName(ctx, syncAttributes);
newUser.setFullName(fullName);
user.setFullName(fullName);

checkEmail(email);
newUser.setEmail(email);
newUser.setMetadata(defaultMetaData());
newUser.setUserType(UserType.LDAP);
newUser.setRole(UserRole.USER);
newUser.setExpired(false);
user.setEmail(email);
user.setMetadata(defaultMetaData());
user.setUserType(UserType.LDAP);
user.setRole(UserRole.USER);
user.setExpired(false);

final Project project = generatePersonalProject(newUser);
newUser.getProjects().add(project.getUsers().iterator().next());
final Project project = generatePersonalProject(user);
user.getProjects().add(project.getUsers().iterator().next());

return userRepository.save(newUser);
return userRepository.save(user);
}

private String getFullName(DirContextOperations ctx, Map<String, String> syncAttributes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ public User replicateUser(ReportPortalSamlAuthentication samlAuthentication) {

User user = new User();
user.setLogin(userName);
user.setUuid(UUID.randomUUID());
user.setActive(Boolean.TRUE);

List<Attribute> details = samlAuthentication.getDetails();

Expand Down
Loading