aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorGuillaume Jambet <guillaume.jambet@sonarsource.com>2017-12-11 18:00:55 +0100
committerStas Vilchik <stas.vilchik@sonarsource.com>2018-01-02 10:38:10 +0100
commit5ff3a01b2fafe930ea582cc637564e24e9ce66da (patch)
treeac1f1911c759a392d1d2becab9c20c27483b4d71 /server
parent82d363f3bc37245ea92c77b5c1b0ea418f91dbb5 (diff)
downloadsonarqube-5ff3a01b2fafe930ea582cc637564e24e9ce66da.tar.gz
sonarqube-5ff3a01b2fafe930ea582cc637564e24e9ce66da.zip
SONAR-10184 Add stub for homepage fields to api/users/current
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/user/ws/CurrentAction.java3
-rw-r--r--server/sonar-server/src/main/resources/org/sonar/server/user/ws/current-example.json4
2 files changed, 7 insertions, 0 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ws/CurrentAction.java b/server/sonar-server/src/main/java/org/sonar/server/user/ws/CurrentAction.java
index 60be4700c6e..0e931ad7b2a 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/user/ws/CurrentAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/user/ws/CurrentAction.java
@@ -34,12 +34,14 @@ import org.sonar.server.issue.ws.AvatarResolver;
import org.sonar.server.organization.DefaultOrganizationProvider;
import org.sonar.server.user.UserSession;
import org.sonarqube.ws.Users.CurrentWsResponse;
+import org.sonarqube.ws.Users.CurrentWsResponse.Homepage;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Strings.emptyToNull;
import static java.util.Collections.singletonList;
import static org.sonar.core.util.Protobuf.setNullable;
import static org.sonar.server.ws.WsUtils.writeProtobuf;
+import static org.sonarqube.ws.Users.CurrentWsResponse.HomepageType.PROJECT;
import static org.sonarqube.ws.Users.CurrentWsResponse.Permissions;
import static org.sonarqube.ws.Users.CurrentWsResponse.newBuilder;
import static org.sonarqube.ws.client.user.UsersWsParameters.ACTION_CURRENT;
@@ -96,6 +98,7 @@ public class CurrentAction implements UsersWsAction {
.addAllGroups(groups)
.addAllScmAccounts(user.getScmAccountsAsList())
.setPermissions(Permissions.newBuilder().addAllGlobal(getGlobalPermissions()).build())
+ .setHomepage(Homepage.newBuilder().setType(PROJECT).setValue("project-key").build())
.setShowOnboardingTutorial(!user.isOnboarded());
setNullable(emptyToNull(user.getEmail()), builder::setEmail);
setNullable(emptyToNull(user.getEmail()), u -> builder.setAvatar(avatarResolver.create(user)));
diff --git a/server/sonar-server/src/main/resources/org/sonar/server/user/ws/current-example.json b/server/sonar-server/src/main/resources/org/sonar/server/user/ws/current-example.json
index 359d2f79961..8b373a028a2 100644
--- a/server/sonar-server/src/main/resources/org/sonar/server/user/ws/current-example.json
+++ b/server/sonar-server/src/main/resources/org/sonar/server/user/ws/current-example.json
@@ -12,5 +12,9 @@
"groups": ["Jedi", "Rebel"],
"permissions": {
"global": ["profileadmin", "scan"]
+ },
+ "homepage": {
+ "type": "PROJECT",
+ "value": "project-key"
}
}