diff --git a/backend/.gitignore b/backend/.gitignore index c2065bc..9b7acf6 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -35,3 +35,5 @@ out/ ### VS Code ### .vscode/ + +/cdn 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 f09e92e..8d1f1ca 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ApplicationsController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/ApplicationsController.java @@ -64,9 +64,12 @@ public class ApplicationsController { if (!authServ.isNotIn(new Role[]{Role.Teacher,Role.Secretary,Role.Admin},token)) authorizedApps.add(Applications.ManageCourses); - if (!authServ.isNotIn(new Role[]{Role.InscriptionService,Role.Admin},token)) + if (!authServ.isNotIn(new Role[]{Role.InscriptionService,Role.Admin},token)){ authorizedApps.add(Applications.Inscription); + authorizedApps.add(Applications.StudentsList);} + if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){ + authorizedApps.add(Applications.UsersList);} return authorizedApps; } } diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CourseController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CourseController.java index 566121d..d5e87a8 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CourseController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/CourseController.java @@ -74,7 +74,8 @@ public class CourseController { public ResponseEntity> postCourse(@RequestHeader("Authorization") String token, @RequestBody Course course) { - + System.out.println(course); + System.out.println(token); if (authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)) return new UnauthorizedResponse<>(null); diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/InscriptionController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/InscriptionController.java index c70e4df..35c4852 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/InscriptionController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/InscriptionController.java @@ -57,7 +57,6 @@ public class InscriptionController { @RequestHeader("Authorization") String token, @RequestBody RequestState state) { - if (authServ.isNotIn(new Role[]{Role.InscriptionService,Role.Admin},token)) return new UnauthorizedResponse<>(null); diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java index 6707fb7..621a470 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/MockController.java @@ -53,8 +53,9 @@ public class MockController { User joe = new User("Mama","Joe","student@student.com","roundabout","DaWarudo",new Date(0), null,Role.Student,passwordEncoder.encode("student")); User meh = new User("Inspiration","lackOf","secretary@secretary.com","a Box","the street",new Date(0), null,Role.Secretary,passwordEncoder.encode("secretary")); User joke = new User("CthemBalls","Lemme","teacher@teacher.com","lab","faculty",new Date(0), null,Role.Teacher,passwordEncoder.encode("teacher")); + User jojo = new User("hhoo","yeay","teacher2@teacher2.com","lab","faculty",new Date(0), null,Role.Teacher,passwordEncoder.encode("teacher")); User lena = new User("Louille","Lena","inscriptionService@InscriptionService.com","no","yes",new Date(0), null,Role.InscriptionService,passwordEncoder.encode("inscriptionService")); - mockUsers = new ArrayList<>(Arrays.asList(herobrine,joe,meh,joke,lena)); + mockUsers = new ArrayList<>(Arrays.asList(herobrine,joe,meh,joke,lena,jojo)); userRepo.saveAll(mockUsers); @@ -91,7 +92,7 @@ public class MockController { CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,chemistry1)); - InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 1,RequestState.Refused,"yes.png","password"); + InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 1,RequestState.Pending,"yes.png","password"); inscriptionService.save(inscriptionRequest); diff --git a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/UserController.java b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/UserController.java index d93ed54..20ca9ee 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/EndPoints/UserController.java +++ b/backend/src/main/java/ovh/herisson/Clyde/EndPoints/UserController.java @@ -63,7 +63,7 @@ public class UserController { public ResponseEntity>> getAllUsers(@RequestHeader("Authorization") String token){ if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token)) - return new UnauthorizedResponse<>(null); + return new UnauthorizedResponse<>(null); Role posterRole = authServ.getUserFromToken(token).getRole(); @@ -122,9 +122,10 @@ public class UserController { return new ResponseEntity<>(ProtectionService.usersWithoutPasswords(students), HttpStatus.OK); } + @DeleteMapping("/user/{id}") public ResponseEntity deleteStudent(@RequestHeader("Authorization") String token, @PathVariable Long id){ - if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token) || id.equals(authServ.getUserFromToken(token).getRegNo())) + if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token) && !id.equals(authServ.getUserFromToken(token).getRegNo())) return new UnauthorizedResponse<>(null); User toDelete = userService.getUserById(id); @@ -135,4 +136,4 @@ public class UserController { userService.delete(toDelete); return new ResponseEntity<>(HttpStatus.OK); } -} \ No newline at end of file +} diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/UserService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/UserService.java index 0c88d15..72eabd5 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/UserService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/UserService.java @@ -123,6 +123,7 @@ public class UserService { public Iterable getAllStudents(){return userRepo.findAllStudents();} + public User getUserById(long id) { return userRepo.findById(id); } diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Applications.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Applications.java index 6ad6567..3dadcec 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Applications.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Applications.java @@ -15,7 +15,9 @@ public enum Applications { // teachers and Secretary authorization ManageCourses, + UsersList, // InscriptionService authorization - Inscription + Inscription, + StudentsList } diff --git a/frontend/src/assets/Clyde.png b/frontend/public/Clyde.png similarity index 100% rename from frontend/src/assets/Clyde.png rename to frontend/public/Clyde.png diff --git a/frontend/public/i18n/EN.txt b/frontend/public/i18n/EN.txt index 90a001d..e79a8a1 100644 --- a/frontend/public/i18n/EN.txt +++ b/frontend/public/i18n/EN.txt @@ -26,6 +26,8 @@ app.inscription.requests=Inscription Requests app.manage.courses=Manage Courses app.language=Language app.manage.profile=Manage profile +app.studentList=Students List +app.users=Users request.moreInfos=More Infos request.accept=Accept request.refuse=Refuse @@ -41,10 +43,12 @@ profile.unRegister=Unregister profile.course.list=Courses list profile.address=Address profile.picture=Profile picture +profile.change.curriculum=Change curriculum name=Name -teacher=Teacher -student=Student -secretary=Secretary -curriculum=curriculum -credits=Credits +Teacher=Teacher +Student=Student +Secretary=Secretary +Curriculum=curriculum +Credits=Credits +InscriptionService=I.S. faculty=Faculty diff --git a/frontend/public/i18n/FR.txt b/frontend/public/i18n/FR.txt index c2f7689..c5f3ebf 100644 --- a/frontend/public/i18n/FR.txt +++ b/frontend/public/i18n/FR.txt @@ -26,6 +26,8 @@ app.inscription.requests=Demandes d'Inscription app.manage.courses=Gérer les cours app.language=Langue app.manage.profile=Gérer le profil +app.studentList=Liste des étudiants +app.users=Utilisateurs request.moreInfos=Plus d'Infos request.accept=Accepter request.refuse=Refuser @@ -41,10 +43,12 @@ profile.unRegister=Désinscription profile.course.list=Liste des cours profile.address=Adresse profile.picture=Photo de profil +profile.change.curriculum=Changer cursus name=Nom -teacher=Enseignant -student=Etudiant -secretary=Secrétaire -curriculum=Cursus -credits=Credits +Teacher=Enseignant +Student=Etudiant +Secretary=Secrétaire +Curriculum=Cursus +Credits=Credits +InscriptionService=S.I. faculty=Faculté diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 030c38d..7d79e82 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -5,14 +5,26 @@ import { isLogged } from '@/rest/Users.js' import { appList, currentView } from '@/rest/apps.js' + var prevURL; + var currentURL = window.location.hash; +window.onhashchange = function() { + prevURL = currentURL; + currentURL = window.location.hash; +} +const Logged = ref(isLogged()); + +window.addEventListener('hashchange', () => { + if((location.hash === "#/home" && prevURL === "#/login") || (location.hash === "#/home" && prevURL === "#/profil")){ + window.location.reload(); + } +}); const home=ref(i18n("app.home")) const notifications=ref(i18n("app.notifications")) const settings=ref(i18n("app.settings")) const login=ref(i18n("app.login")) const active=ref(false) - const Logged = ref(isLogged()); const apps = ref([]) appList().then(e => apps.value = e) @@ -26,7 +38,7 @@
  • - +
  • @@ -66,17 +78,19 @@
    + + +
    diff --git a/frontend/src/Apps/Inscription.vue b/frontend/src/Apps/Inscription.vue index 511a403..94a1811 100644 --- a/frontend/src/Apps/Inscription.vue +++ b/frontend/src/Apps/Inscription.vue @@ -1,10 +1,113 @@ -