ALINE:controller contact blocage préauthorize
This commit is contained in:
		
							parent
							
								
									0f55e66702
								
							
						
					
					
						commit
						8a96240fd6
					
				
					 1 changed files with 5 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -21,7 +21,7 @@ public class ContactController {
 | 
			
		|||
    private ContactRepository contactRepo;
 | 
			
		||||
 | 
			
		||||
    @GetMapping(value = "/{id}")
 | 
			
		||||
    @PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
 | 
			
		||||
    //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
 | 
			
		||||
    public ResponseEntity<?> findById(@PathVariable int id){
 | 
			
		||||
        Optional<Contact> contact = null;
 | 
			
		||||
        try
 | 
			
		||||
| 
						 | 
				
			
			@ -35,7 +35,7 @@ public class ContactController {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping(value = "team/{team_id}")
 | 
			
		||||
    @PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
 | 
			
		||||
    //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
 | 
			
		||||
    public ResponseEntity<?> findByTeamId(@PathVariable int team_id){
 | 
			
		||||
        List<Contact> contacts = null;
 | 
			
		||||
        try
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +49,7 @@ public class ContactController {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value="/add")
 | 
			
		||||
    @PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
 | 
			
		||||
    //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
 | 
			
		||||
    public ResponseEntity<?> addContact(@RequestBody Contact contact){
 | 
			
		||||
        Contact resultContact = null;
 | 
			
		||||
        try {
 | 
			
		||||
| 
						 | 
				
			
			@ -62,7 +62,7 @@ public class ContactController {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @PutMapping("/update/{id}")
 | 
			
		||||
    @PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
 | 
			
		||||
    //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
 | 
			
		||||
    public ResponseEntity<?> updateContact(@RequestBody Contact contact, @PathVariable Integer id) throws Exception {
 | 
			
		||||
        Contact resultContact = null;
 | 
			
		||||
        try {
 | 
			
		||||
| 
						 | 
				
			
			@ -76,7 +76,7 @@ public class ContactController {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @DeleteMapping(value = "/delete/{id}")
 | 
			
		||||
    @PreAuthorize("hasRole('ROLE_PARENT')")
 | 
			
		||||
    //@PreAuthorize("hasRole('ROLE_PARENT')")
 | 
			
		||||
    public ResponseEntity<?> deleteContact(@PathVariable int id){
 | 
			
		||||
        try {
 | 
			
		||||
            contactRepo.delete(contactRepo.getById(id));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue