From aa2b16f8dec184144c533f75629e28ee30bc610c Mon Sep 17 00:00:00 2001 From: Wojtek Wajerowicz <115081248+wojciech-wajerowicz-sonarsource@users.noreply.github.com> Date: Thu, 16 Nov 2023 11:02:21 +0100 Subject: [PATCH] SONAR-21031 update /users endpoint to include domain in the path --- server/sonar-web/src/main/js/api/users.ts | 12 ++++++++---- .../java/org/sonar/server/v2/WebApiEndpoints.java | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/server/sonar-web/src/main/js/api/users.ts b/server/sonar-web/src/main/js/api/users.ts index 218806c32b0..f4bbe883ca0 100644 --- a/server/sonar-web/src/main/js/api/users.ts +++ b/server/sonar-web/src/main/js/api/users.ts @@ -30,6 +30,8 @@ import { RestUserDetailed, } from '../types/users'; +const USERS_ENDPOINT = '/api/v2/users-management/users'; + export function getCurrentUser(): Promise { return getJSON('/api/users/current', undefined, true); } @@ -86,7 +88,9 @@ export function getUsers(data: { pageSize?: number; pageIndex?: number; }) { - return axios.get<{ page: Paging; users: T[] }>(`/api/v2/users`, { params: data }); + return axios.get<{ page: Paging; users: T[] }>(USERS_ENDPOINT, { + params: data, + }); } export function postUser(data: { @@ -96,18 +100,18 @@ export function postUser(data: { password?: string; scmAccounts: string[]; }) { - return axiosToCatch.post('/api/v2/users', data); + return axiosToCatch.post(USERS_ENDPOINT, data); } export function updateUser( id: string, data: Partial>, ) { - return axiosToCatch.patch(`/api/v2/users/${id}`, data); + return axiosToCatch.patch(`${USERS_ENDPOINT}/${id}`, data); } export function deleteUser({ login, anonymize }: { login: string; anonymize?: boolean }) { - return axios.delete(`/api/v2/users/${login}`, { params: { anonymize } }); + return axios.delete(`${USERS_ENDPOINT}/${login}`, { params: { anonymize } }); } export function setHomePage(homepage: HomePage): Promise { diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/WebApiEndpoints.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/WebApiEndpoints.java index 35661b69b5c..aacc93538c8 100644 --- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/WebApiEndpoints.java +++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/WebApiEndpoints.java @@ -23,7 +23,9 @@ public class WebApiEndpoints { private static final String SYSTEM_ENDPOINTS = "/system"; public static final String LIVENESS_ENDPOINT = SYSTEM_ENDPOINTS + "/liveness"; public static final String HEALTH_ENDPOINT = SYSTEM_ENDPOINTS + "/health"; - public static final String USER_ENDPOINT = "/users"; + + public static final String USERS_MANAGEMENT_DOMAIN = "/users-management"; + public static final String USER_ENDPOINT = USERS_MANAGEMENT_DOMAIN + "/users"; public static final String GITHUB_PERMISSIONS_ENDPOINT = "/github-permission-mappings"; public static final String JSON_MERGE_PATCH_CONTENT_TYPE = "application/merge-patch+json"; -- 2.39.5