aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-auth/src
diff options
context:
space:
mode:
authorPierre Guillot <50145663+pierre-guillot-sonarsource@users.noreply.github.com>2022-06-07 09:48:04 +0200
committersonartech <sonartech@sonarsource.com>2022-06-07 20:03:10 +0000
commit4597d09ca1a81c86a56f416d2a9b4cb27e6ca4c2 (patch)
tree454cac73481faf13d3773caab4c5026fbb4541f4 /server/sonar-webserver-auth/src
parent624f20e1bbcda0bd58e544144b023ad345d582f6 (diff)
downloadsonarqube-4597d09ca1a81c86a56f416d2a9b4cb27e6ca4c2.tar.gz
sonarqube-4597d09ca1a81c86a56f416d2a9b4cb27e6ca4c2.zip
SONAR-16449 remove SonarCloud references in SonarQube codebase
Diffstat (limited to 'server/sonar-webserver-auth/src')
-rw-r--r--server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java8
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java19
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java29
-rw-r--r--server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java31
4 files changed, 0 insertions, 87 deletions
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java
index d8d9fca10f3..7df1a44f9b3 100644
--- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java
+++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/user/UserUpdater.java
@@ -55,7 +55,6 @@ import static java.util.stream.Stream.concat;
import static org.sonar.api.CoreProperties.DEFAULT_ISSUE_ASSIGNEE;
import static org.sonar.core.util.Slug.slugify;
import static org.sonar.core.util.stream.MoreCollectors.toList;
-import static org.sonar.process.ProcessProperties.Property.ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS;
import static org.sonar.server.exceptions.BadRequestException.checkRequest;
@ServerSide
@@ -118,7 +117,6 @@ public class UserUpdater {
if (password != null) {
updateUser.setPassword(password);
}
- setOnboarded(reactivatedUser);
updateDto(dbSession, updateUser, reactivatedUser);
updateUser(dbSession, reactivatedUser);
addUserToDefaultGroup(dbSession, reactivatedUser);
@@ -177,7 +175,6 @@ public class UserUpdater {
}
setExternalIdentity(dbSession, userDto, newUser.externalIdentity());
- setOnboarded(userDto);
checkRequest(messages.isEmpty(), messages);
return userDto;
@@ -306,11 +303,6 @@ public class UserUpdater {
"A user with provider id '%s' and identity provider '%s' already exists", dto.getExternalId(), dto.getExternalIdentityProvider());
}
- private void setOnboarded(UserDto userDto) {
- boolean showOnboarding = config.getBoolean(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey()).orElse(false);
- userDto.setOnboarded(!showOnboarding);
- }
-
private static boolean checkNotEmptyParam(@Nullable String value, String param, List<String> messages) {
if (isNullOrEmpty(value)) {
messages.add(format(Validation.CANT_BE_EMPTY_MESSAGE, param));
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java
index e535e6416be..accef48c744 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/authentication/UserRegistrarImplTest.java
@@ -51,7 +51,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.sonar.db.user.UserTesting.newUserDto;
-import static org.sonar.process.ProcessProperties.Property.ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS;
import static org.sonar.server.authentication.event.AuthenticationEvent.Method.BASIC;
public class UserRegistrarImplTest {
@@ -168,24 +167,6 @@ public class UserRegistrarImplTest {
}
@Test
- public void authenticate_new_user_sets_onboarded_flag_to_false_when_onboarding_setting_is_set_to_true() {
- settings.setProperty(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey(), true);
-
- UserDto user = underTest.register(newUserRegistration());
-
- assertThat(db.users().selectUserByLogin(user.getLogin()).get().isOnboarded()).isFalse();
- }
-
- @Test
- public void authenticate_new_user_sets_onboarded_flag_to_true_when_onboarding_setting_is_set_to_false() {
- settings.setProperty(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey(), false);
-
- UserDto user = underTest.register(newUserRegistration());
-
- assertThat(db.users().selectUserByLogin(user.getLogin()).get().isOnboarded()).isTrue();
- }
-
- @Test
public void authenticate_new_user_sets_external_id_to_provider_login_when_id_is_null() {
UserIdentity newUser = UserIdentity.builder()
.setProviderId(null)
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java
index 55dff0fef63..5d799c5cc0b 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterCreateTest.java
@@ -53,7 +53,6 @@ import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.sonar.db.user.UserTesting.newLocalUser;
-import static org.sonar.process.ProcessProperties.Property.ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS;
import static org.sonar.server.user.ExternalIdentity.SQ_AUTHORITY;
public class UserUpdaterCreateTest {
@@ -266,34 +265,6 @@ public class UserUpdaterCreateTest {
}
@Test
- public void create_not_onboarded_user_if_onboarding_setting_is_set_to_false() {
- settings.setProperty(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey(), false);
- createDefaultGroup();
-
- underTest.createAndCommit(db.getSession(), NewUser.builder()
- .setLogin("user")
- .setName("User")
- .build(), u -> {
- });
-
- assertThat(dbClient.userDao().selectByLogin(session, "user").isOnboarded()).isTrue();
- }
-
- @Test
- public void create_onboarded_user_if_onboarding_setting_is_set_to_true() {
- settings.setProperty(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey(), true);
- createDefaultGroup();
-
- underTest.createAndCommit(db.getSession(), NewUser.builder()
- .setLogin("user")
- .setName("User")
- .build(), u -> {
- });
-
- assertThat(dbClient.userDao().selectByLogin(session, "user").isOnboarded()).isFalse();
- }
-
- @Test
public void create_user_and_index_other_user() {
createDefaultGroup();
UserDto otherUser = db.users().insertUser();
diff --git a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java
index 9698cd53b29..b5448e9caf9 100644
--- a/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java
+++ b/server/sonar-webserver-auth/src/test/java/org/sonar/server/user/UserUpdaterReactivateTest.java
@@ -47,7 +47,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import static org.sonar.process.ProcessProperties.Property.ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS;
public class UserUpdaterReactivateTest {
@@ -238,36 +237,6 @@ public class UserUpdaterReactivateTest {
}
@Test
- public void reactivate_not_onboarded_user_if_onboarding_setting_is_set_to_false() {
- settings.setProperty(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey(), false);
- UserDto user = db.users().insertDisabledUser(u -> u.setOnboarded(false));
- createDefaultGroup();
-
- underTest.reactivateAndCommit(db.getSession(), user, NewUser.builder()
- .setLogin(user.getLogin())
- .setName(user.getName())
- .build(), u -> {
- });
-
- assertThat(dbClient.userDao().selectByLogin(session, user.getLogin()).isOnboarded()).isTrue();
- }
-
- @Test
- public void reactivate_onboarded_user_if_onboarding_setting_is_set_to_true() {
- settings.setProperty(ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS.getKey(), true);
- UserDto user = db.users().insertDisabledUser(u -> u.setOnboarded(true));
- createDefaultGroup();
-
- underTest.reactivateAndCommit(db.getSession(), user, NewUser.builder()
- .setLogin(user.getLogin())
- .setName(user.getName())
- .build(), u -> {
- });
-
- assertThat(dbClient.userDao().selectByLogin(session, user.getLogin()).isOnboarded()).isFalse();
- }
-
- @Test
public void fail_to_reactivate_user_when_login_already_exists() {
createDefaultGroup();
UserDto user = db.users().insertUser(u -> u.setActive(false));