Compare commits
No commits in common. "dcec45acf55ef1f8b27eb5fb9ce8c018ef7f51a5" and "069466ef5faa9ee89042ddf0c823f493640a7fdb" have entirely different histories.
dcec45acf5
...
069466ef5f
@ -90,24 +90,6 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/students")
|
|
||||||
public ResponseEntity<Iterable<HashMap<String,Object>>> getAllStudent(@RequestHeader("Authorization") String token){
|
|
||||||
if (authServ.getUserFromToken(token) == null)
|
|
||||||
return new UnauthorizedResponse<>(null);
|
|
||||||
|
|
||||||
Iterable<User> teachers = userService.getAllStudents();
|
|
||||||
ArrayList<HashMap<String, Object>> withoutPassword = new ArrayList<>();
|
|
||||||
|
|
||||||
for (User t: teachers){
|
|
||||||
withoutPassword.add(userWithoutPassword(t));
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ResponseEntity<>(withoutPassword, HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** return user's data except password
|
/** return user's data except password
|
||||||
* @param user the user to return
|
* @param user the user to return
|
||||||
|
@ -19,7 +19,4 @@ public interface UserRepository extends CrudRepository<User, Long> {
|
|||||||
@Query("select u from User u where u.role = ovh.herisson.Clyde.Tables.Role.Teacher")
|
@Query("select u from User u where u.role = ovh.herisson.Clyde.Tables.Role.Teacher")
|
||||||
Iterable<User> findAllTeachers();
|
Iterable<User> findAllTeachers();
|
||||||
|
|
||||||
|
|
||||||
@Query("select u from User u where u.role = ovh.herisson.Clyde.Tables.Role.Student")
|
|
||||||
Iterable<User> findAllStudents();
|
|
||||||
}
|
}
|
@ -107,6 +107,4 @@ public class UserService {
|
|||||||
|
|
||||||
|
|
||||||
public Iterable<User> getAllTeachers (){return userRepo.findAllTeachers();}
|
public Iterable<User> getAllTeachers (){return userRepo.findAllTeachers();}
|
||||||
|
|
||||||
public Iterable<User> getAllStudents(){return userRepo.findAllStudents();}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user