Merge branch 'Max/Backend/GetUserById' into wal/front/listingUsers
This commit is contained in:
		@ -40,6 +40,16 @@ public class UserController {
 | 
			
		||||
        return new ResponseEntity<>(ProtectionService.userWithoutPassword(user), HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/user/{id}")
 | 
			
		||||
    public ResponseEntity<HashMap<String ,Object>> getUserById(@RequestHeader("Authorization") String token, @PathVariable Long id){
 | 
			
		||||
 | 
			
		||||
        if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
 | 
			
		||||
            return new UnauthorizedResponse<>(null);
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity<>(ProtectionService.userWithoutPassword(userService.getUserById(id)), HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping("/user")
 | 
			
		||||
    public ResponseEntity<Map<String ,Object>> postUser(@RequestBody User user,@RequestHeader("Authorization") String token){
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -122,4 +122,9 @@ public class UserService {
 | 
			
		||||
    public Iterable<User> getAllTeachers (){return userRepo.findAllTeachers();}
 | 
			
		||||
 | 
			
		||||
    public Iterable<User> getAllStudents(){return userRepo.findAllStudents();}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public User getUserById(long id) {
 | 
			
		||||
        return userRepo.findById(id);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user