Compare commits
No commits in common. "3ea48c20aa44e617b4074af147de21655a8e2452" and "6116cbdaa4fcc9dda31b652f12ea08ba54ff7b4e" have entirely different histories.
3ea48c20aa
...
6116cbdaa4
@ -1,6 +1,5 @@
|
|||||||
package ovh.herisson.Clyde.EndPoints;
|
package ovh.herisson.Clyde.EndPoints;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
@ -9,7 +8,6 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||||
import ovh.herisson.Clyde.Services.ScientificPublications.ResearchesService;
|
|
||||||
import ovh.herisson.Clyde.Tables.Applications;
|
import ovh.herisson.Clyde.Tables.Applications;
|
||||||
import ovh.herisson.Clyde.Tables.Role;
|
import ovh.herisson.Clyde.Tables.Role;
|
||||||
import ovh.herisson.Clyde.Tables.User;
|
import ovh.herisson.Clyde.Tables.User;
|
||||||
@ -22,10 +20,7 @@ public class ApplicationsController {
|
|||||||
|
|
||||||
AuthenticatorService authServ;
|
AuthenticatorService authServ;
|
||||||
|
|
||||||
ResearchesService researchesServ;
|
public ApplicationsController(AuthenticatorService authServ){
|
||||||
|
|
||||||
public ApplicationsController(AuthenticatorService authServ, ResearchesService researchesServ){
|
|
||||||
this.researchesServ = researchesServ;
|
|
||||||
this.authServ = authServ;
|
this.authServ = authServ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +47,7 @@ public class ApplicationsController {
|
|||||||
|
|
||||||
//if unAuthed
|
//if unAuthed
|
||||||
authorizedApps.add(Applications.Login);
|
authorizedApps.add(Applications.Login);
|
||||||
|
authorizedApps.add(Applications.ResearcherProfile);
|
||||||
|
|
||||||
User user = authServ.getUserFromToken(token);
|
User user = authServ.getUserFromToken(token);
|
||||||
if(user == null)
|
if(user == null)
|
||||||
@ -75,9 +71,6 @@ public class ApplicationsController {
|
|||||||
|
|
||||||
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
|
if (!authServ.isNotIn(new Role[]{Role.Secretary,Role.Admin},token)){
|
||||||
authorizedApps.add(Applications.UsersList);}
|
authorizedApps.add(Applications.UsersList);}
|
||||||
|
|
||||||
if (researchesServ.getResearcherByUser(user) != null)
|
|
||||||
authorizedApps.add(Applications.ManageResearcherProfile);
|
|
||||||
return authorizedApps;
|
return authorizedApps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,16 +50,6 @@ public class ResearcherController {
|
|||||||
return new ResponseEntity<>(toReturnResearchersDTO, HttpStatus.OK);
|
return new ResponseEntity<>(toReturnResearchersDTO, HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/researcher")
|
|
||||||
public ResponseEntity<ResearcherDTO> getSelf(@RequestHeader("Authorization") String token){
|
|
||||||
|
|
||||||
Researcher self = researchesServ.getResearcherByUser(authServ.getUserFromToken(token));
|
|
||||||
|
|
||||||
if (self ==null) return new UnauthorizedResponse<>(null);
|
|
||||||
|
|
||||||
return new ResponseEntity<>(ResearcherDTO.construct(self), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/researcher")
|
@PostMapping("/researcher")
|
||||||
public ResponseEntity<ResearcherDTO> postResearcher(@RequestHeader("Authorization") String token, @RequestBody Researcher researcher){
|
public ResponseEntity<ResearcherDTO> postResearcher(@RequestHeader("Authorization") String token, @RequestBody Researcher researcher){
|
||||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary}, token)){
|
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary}, token)){
|
||||||
|
@ -7,6 +7,7 @@ public enum Applications {
|
|||||||
// with any token
|
// with any token
|
||||||
Profile,
|
Profile,
|
||||||
|
|
||||||
|
|
||||||
// Students and higher authorization
|
// Students and higher authorization
|
||||||
Msg,
|
Msg,
|
||||||
Forum,
|
Forum,
|
||||||
@ -20,6 +21,5 @@ public enum Applications {
|
|||||||
Requests,
|
Requests,
|
||||||
// profile of a researcher
|
// profile of a researcher
|
||||||
ResearcherProfile,
|
ResearcherProfile,
|
||||||
ManageResearcherProfile,
|
|
||||||
StudentsList
|
StudentsList
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ app.language=Language
|
|||||||
app.manage.profile=Manage profile
|
app.manage.profile=Manage profile
|
||||||
app.studentList=Students List
|
app.studentList=Students List
|
||||||
app.users=Users
|
app.users=Users
|
||||||
app.manage.researcherProfile=Manage researcher profile
|
|
||||||
request.moreInfos=More Infos
|
request.moreInfos=More Infos
|
||||||
request.accept=Accept
|
request.accept=Accept
|
||||||
request.refuse=Refuse
|
request.refuse=Refuse
|
||||||
|
@ -28,7 +28,6 @@ app.language=Langue
|
|||||||
app.manage.profile=Gérer le profil
|
app.manage.profile=Gérer le profil
|
||||||
app.studentList=Liste des étudiants
|
app.studentList=Liste des étudiants
|
||||||
app.users=Utilisateurs
|
app.users=Utilisateurs
|
||||||
app.manage.researcherProfile= gérer son profil de chercheur
|
|
||||||
request.moreInfos=Plus d'Infos
|
request.moreInfos=Plus d'Infos
|
||||||
request.accept=Accepter
|
request.accept=Accepter
|
||||||
request.refuse=Refuser
|
request.refuse=Refuser
|
||||||
|
@ -19,7 +19,3 @@ export async function getFile(url){
|
|||||||
const restURL = import.meta.env.VITE_CLYDE_MODE === 'container' ? "http://localhost:8000": import.meta.env.DEV ? "http://localhost:5173" : "https://clyde.herisson.ovh/api"
|
const restURL = import.meta.env.VITE_CLYDE_MODE === 'container' ? "http://localhost:8000": import.meta.env.DEV ? "http://localhost:5173" : "https://clyde.herisson.ovh/api"
|
||||||
await fetch(restURL + "/"+url, {method: "GET"})
|
await fetch(restURL + "/"+url, {method: "GET"})
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getSelf(){
|
|
||||||
return restGet("/researcher")
|
|
||||||
}
|
|
@ -13,7 +13,6 @@ import ResearcherProfile from "@/Apps/ScientificPublications/ResearcherProfile.v
|
|||||||
import AboutStudent from "@/Apps/Inscription/AboutStudent.vue";
|
import AboutStudent from "@/Apps/Inscription/AboutStudent.vue";
|
||||||
import Msg from "@/Apps/Msg.vue"
|
import Msg from "@/Apps/Msg.vue"
|
||||||
import ManageRequests from "@/Apps/Inscription/ManageRequests.vue";
|
import ManageRequests from "@/Apps/Inscription/ManageRequests.vue";
|
||||||
import ManageResearcherProfile from "@/Apps/ScientificPublications/ManageResearcherProfile.vue";
|
|
||||||
|
|
||||||
const apps = {
|
const apps = {
|
||||||
'/login': LoginPage,
|
'/login': LoginPage,
|
||||||
@ -22,7 +21,7 @@ const apps = {
|
|||||||
'/manage-courses' : Courses,
|
'/manage-courses' : Courses,
|
||||||
'/users-list' : Users,
|
'/users-list' : Users,
|
||||||
'/students-list' : Students,
|
'/students-list' : Students,
|
||||||
'/manage-researcher-profile' : ManageResearcherProfile,
|
'/researcher-profile' : ResearcherProfile,
|
||||||
'/msg' : Msg,
|
'/msg' : Msg,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +34,7 @@ const appsList = {
|
|||||||
'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") },
|
'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") },
|
||||||
'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")},
|
'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")},
|
||||||
'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")},
|
'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")},
|
||||||
'ManageResearcherProfile':{path:'#/researcher-profile',icon:'fa-book-bookmark',text:i18n("app.manage.researcherProfile")},
|
'ResearcherProfile':{path:'#/researcher-profile',icon:'fa-book-bookmark',text:"hihi"},
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentPath = ref(window.location.hash)
|
const currentPath = ref(window.location.hash)
|
||||||
|
Loading…
Reference in New Issue
Block a user