added security to assistant posting and Get courses/owned for owners
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user