]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21031 update /users endpoint to include domain in the path
authorWojtek Wajerowicz <115081248+wojciech-wajerowicz-sonarsource@users.noreply.github.com>
Thu, 16 Nov 2023 10:02:21 +0000 (11:02 +0100)
committersonartech <sonartech@sonarsource.com>
Fri, 17 Nov 2023 20:03:00 +0000 (20:03 +0000)
server/sonar-web/src/main/js/api/users.ts
server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/WebApiEndpoints.java

index 218806c32b0efcce9ddc00f106cbbdcd65fdb0b6..f4bbe883ca0b38f3e49f425b32d034f44d25aba4 100644 (file)
@@ -30,6 +30,8 @@ import {
   RestUserDetailed,
 } from '../types/users';
 
+const USERS_ENDPOINT = '/api/v2/users-management/users';
+
 export function getCurrentUser(): Promise<CurrentUser> {
   return getJSON('/api/users/current', undefined, true);
 }
@@ -86,7 +88,9 @@ export function getUsers<T extends RestUserBase>(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<RestUserDetailed>('/api/v2/users', data);
+  return axiosToCatch.post<RestUserDetailed>(USERS_ENDPOINT, data);
 }
 
 export function updateUser(
   id: string,
   data: Partial<Pick<RestUserDetailed, 'email' | 'name' | 'scmAccounts'>>,
 ) {
-  return axiosToCatch.patch<RestUserDetailed>(`/api/v2/users/${id}`, data);
+  return axiosToCatch.patch<RestUserDetailed>(`${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<void | Response> {
index 35661b69b5c449e81cf2233d342f75b153241dcd..aacc93538c88d14ce9c1ef63be2ed6841c992716 100644 (file)
@@ -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";