diff --git a/src/main/java/de/tum/cit/aet/artemis/core/web/admin/AdminUserResource.java b/src/main/java/de/tum/cit/aet/artemis/core/web/admin/AdminUserResource.java index b2fb3b4fadd2..3f25c36d8a67 100644 --- a/src/main/java/de/tum/cit/aet/artemis/core/web/admin/AdminUserResource.java +++ b/src/main/java/de/tum/cit/aet/artemis/core/web/admin/AdminUserResource.java @@ -25,7 +25,6 @@ import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; @@ -281,7 +280,7 @@ public ResponseEntity deleteUser(@PathVariable String login) { * @return the ResponseEntity with status 200 (OK) */ @DeleteMapping("users") - public ResponseEntity> deleteUsers(@RequestParam(name = "login") List logins) { + public ResponseEntity> deleteUsers(@RequestBody List logins) { log.debug("REST request to delete {} users", logins.size()); List deletedUsers = Collections.synchronizedList(new java.util.ArrayList<>()); diff --git a/src/main/webapp/app/core/user/admin-user.service.ts b/src/main/webapp/app/core/user/admin-user.service.ts index 0614e9229d3b..73e14d154597 100644 --- a/src/main/webapp/app/core/user/admin-user.service.ts +++ b/src/main/webapp/app/core/user/admin-user.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http'; +import { HttpClient, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; import { createRequestOption } from 'app/shared/util/request.util'; @@ -94,11 +94,7 @@ export class AdminUserService { * @return Observable> */ deleteUsers(logins: string[]): Observable> { - let params = new HttpParams(); - for (const login of logins) { - params = params.append('login', login); - } - return this.http.delete(`${this.resourceUrl}`, { params, observe: 'response' }); + return this.http.delete(`${this.resourceUrl}`, { body: logins, observe: 'response' }); } /** diff --git a/src/test/java/de/tum/cit/aet/artemis/core/user/util/UserTestService.java b/src/test/java/de/tum/cit/aet/artemis/core/user/util/UserTestService.java index 527230b8c446..77ea61f417ee 100644 --- a/src/test/java/de/tum/cit/aet/artemis/core/user/util/UserTestService.java +++ b/src/test/java/de/tum/cit/aet/artemis/core/user/util/UserTestService.java @@ -217,10 +217,8 @@ public void deleteUsers(String currentUserLogin) throws Exception { var users = Set.of(userUtilService.getUserByLogin(TEST_PREFIX + "student1"), userUtilService.getUserByLogin(TEST_PREFIX + "tutor1"), userUtilService.getUserByLogin(TEST_PREFIX + "editor1"), userUtilService.getUserByLogin(TEST_PREFIX + "instructor1")); - LinkedMultiValueMap params = new LinkedMultiValueMap<>(); - users.stream().map(User::getLogin).forEach(login -> params.add("login", login)); - - request.delete("/api/admin/users", HttpStatus.OK, params); + var logins = users.stream().map(User::getLogin).toList(); + request.delete("/api/admin/users", HttpStatus.OK, logins); for (var user : users) { final var deletedUser = userTestRepository.findById(user.getId()).orElseThrow();