Fix merge because i'm bad
This commit is contained in:
		@ -43,28 +43,4 @@ public class CurriculumController {
 | 
			
		||||
    public ResponseEntity<Iterable<CurriculumCourse>> findAll(){
 | 
			
		||||
        return new ResponseEntity<>(curriculumCourseServ.findAll(),HttpStatus.OK);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**@PostMapping("/curriculum")
 | 
			
		||||
    public ResponseEntity<String> postCurriculum(@RequestHeader("Authorization") String token,@RequestBody Curriculum curriculum){
 | 
			
		||||
 | 
			
		||||
        if (!isSecretaryOrAdmin(token)){
 | 
			
		||||
            return new UnauthorizedResponse<>("you're not allowed to post a Curriculum");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        CurriculumServ.save(Curriculum);
 | 
			
		||||
 | 
			
		||||
        return new ResponseEntity<>("created !",HttpStatus.CREATED);
 | 
			
		||||
    }**/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private boolean isSecretaryOrAdmin(String authorization){
 | 
			
		||||
        if (authorization ==null)
 | 
			
		||||
            return false;
 | 
			
		||||
 | 
			
		||||
        User poster = authServ.getUserFromToken(authorization);
 | 
			
		||||
        if (poster == null) return false;
 | 
			
		||||
 | 
			
		||||
        return poster.getRole() == Role.Secretary && poster.getRole() == Role.Admin;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@ public class InscriptionController {
 | 
			
		||||
    @GetMapping("/requests/register")
 | 
			
		||||
    public ResponseEntity<Iterable<Map<String,Object>>> getAllRequests(@RequestHeader("Authorization") String token){
 | 
			
		||||
 | 
			
		||||
        if (!isSecretaryOrAdmin(token)){return new UnauthorizedResponse<>(null);}
 | 
			
		||||
        if (authServ.isNotSecretaryOrAdmin(token)){return new UnauthorizedResponse<>(null);}
 | 
			
		||||
 | 
			
		||||
        Iterable<InscriptionRequest> inscriptionRequests = inscriptionServ.getAll();
 | 
			
		||||
        ArrayList<Map<String,Object>> toReturn = new ArrayList<>();
 | 
			
		||||
@ -64,7 +64,7 @@ public class InscriptionController {
 | 
			
		||||
                                                                 @RequestHeader("Authorize") String token,
 | 
			
		||||
                                                                 @RequestBody RequestState requestState)
 | 
			
		||||
    {
 | 
			
		||||
        if (!isSecretaryOrAdmin(token)) return new UnauthorizedResponse<>(null);
 | 
			
		||||
        if (authServ.isNotSecretaryOrAdmin(token)) return new UnauthorizedResponse<>(null);
 | 
			
		||||
        inscriptionServ.modifyState(id, requestState);
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user