1
0
forked from PGL/Clyde

added security to assistant posting and Get courses/owned for owners

This commit is contained in:
2024-03-17 12:13:03 +01:00
parent f7df234312
commit cf2deb983d
7 changed files with 77 additions and 20 deletions

View File

@ -9,7 +9,6 @@ import ovh.herisson.Clyde.Services.ProtectionService;
import ovh.herisson.Clyde.Services.UserService;
import ovh.herisson.Clyde.Tables.Role;
import ovh.herisson.Clyde.Tables.User;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@ -55,12 +54,8 @@ public class UserController {
return new UnauthorizedResponse<>(null);
Iterable<User> users = userService.getAll();
ArrayList<HashMap<String, Object>> withoutPassword = new ArrayList<>();
for (User u :users){
withoutPassword.add(ProtectionService.userWithoutPassword(u));
}
return new ResponseEntity<>(withoutPassword, HttpStatus.OK);
return new ResponseEntity<>(ProtectionService.usersWithoutPasswords(users), HttpStatus.OK);
}
/** changes the specified user's information
@ -93,13 +88,8 @@ public class UserController {
return new UnauthorizedResponse<>(null);
Iterable<User> teachers = userService.getAllTeachers();
ArrayList<HashMap<String, Object>> withoutPassword = new ArrayList<>();
for (User t: teachers){
withoutPassword.add(ProtectionService.userWithoutPassword(t));
}
return new ResponseEntity<>(withoutPassword, HttpStatus.OK);
return new ResponseEntity<>(ProtectionService.usersWithoutPasswords(teachers), HttpStatus.OK);
}
}