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