1
0
forked from PGL/Clyde

Merge remote-tracking branch 'origin/Max/Backend/UserDelete' into wal/front/listingUsers

This commit is contained in:
Wawilski 2024-03-18 17:36:07 +01:00
commit 77ac771b8f

View File

@ -125,7 +125,7 @@ public class UserController {
@DeleteMapping("/user/{id}") @DeleteMapping("/user/{id}")
public ResponseEntity<String> deleteStudent(@RequestHeader("Authorization") String token, @PathVariable Long id){ public ResponseEntity<String> deleteStudent(@RequestHeader("Authorization") String token, @PathVariable Long id){
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token)) if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token) || id.equals(authServ.getUserFromToken(token).getRegNo()))
return new UnauthorizedResponse<>(null); return new UnauthorizedResponse<>(null);
User toDelete = userService.getUserById(id); User toDelete = userService.getUserById(id);