From 0860567e1b9d0ccbb85cb7c05bcad3359e0df04a Mon Sep 17 00:00:00 2001 From: Bartha Maxime <231026@umons.ac.be> Date: Sat, 16 Mar 2024 00:42:46 +0100 Subject: [PATCH 1/2] fixed the GetAuthorizedApps method --- .../Clyde/EndPoints/ApplicationsController.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ApplicationsController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ApplicationsController.java index d044bf7..d5ad171 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ApplicationsController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ApplicationsController.java @@ -46,11 +46,12 @@ public class ApplicationsController { authorizedApps.add(Applications.LOGIN); authorizedApps.add(Applications.PROFILE); - authorizedApps.add(Applications.MSG); - authorizedApps.add(Applications.FORUM); - authorizedApps.add(Applications.RDV); - if (posterRole == Role.Student || posterRole == Role.Admin) return authorizedApps; + if (posterRole == Role.Teacher || posterRole == Role.Student || posterRole == Role.Admin){ + authorizedApps.add(Applications.MSG); + authorizedApps.add(Applications.FORUM); + authorizedApps.add(Applications.RDV); + } if (posterRole == Role.Teacher || posterRole == Role.Secretary || posterRole == Role.Admin) authorizedApps.add(Applications.MANAGECOURSES); @@ -58,5 +59,4 @@ public class ApplicationsController { return authorizedApps; } - } \ No newline at end of file From b7b2eafb933d9a1cac369dc24f68451459d91591 Mon Sep 17 00:00:00 2001 From: Bartha Maxime <231026@umons.ac.be> Date: Sat, 16 Mar 2024 00:44:11 +0100 Subject: [PATCH 2/2] removed the GET /Apps/{id} frontend just iterates on the /apps list --- .../Clyde/EndPoints/ApplicationsController.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ApplicationsController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ApplicationsController.java index d5ad171..c76d513 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ApplicationsController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ApplicationsController.java @@ -31,16 +31,7 @@ public class ApplicationsController { return new ResponseEntity<>(getAuthorizedApplications(token), HttpStatus.OK); } - @GetMapping("/apps/{identifier}") - public ResponseEntity getAppAuthorization(@PathVariable Applications identifier, @RequestHeader("Authorization") String token){ - - if (getAuthorizedApplications(token).contains(identifier)){ - return new ResponseEntity<>(true, HttpStatus.OK); - } - return new ResponseEntity<>(false, HttpStatus.OK); - } - - public ArrayList getAuthorizedApplications(String token){ + private ArrayList getAuthorizedApplications(String token){ Role posterRole = authServ.getUserFromToken(token).getRole(); ArrayList authorizedApps = new ArrayList<>();