Compare commits
No commits in common. "b2d0be014c5bbfe14b892fbc108b6450ffb940eb" and "b67b25b4a465e7c343eef57f820006bc70051a5f" have entirely different histories.
b2d0be014c
...
b67b25b4a4
@ -48,9 +48,9 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/users")
|
@GetMapping("/users")
|
||||||
public ResponseEntity<Iterable<HashMap<String,Object>>> getAllUsers(@RequestHeader("authorization") String authorization){
|
public ResponseEntity<Iterable<HashMap<String,Object>>> getAllUsers(@RequestHeader("Authorization") String authorization){
|
||||||
System.out.println(authorization);
|
|
||||||
if (authServ.IsNotIn(new Role[]{Role.Admin,Role.Secretary},authorization))
|
if (authServ.isNotSecretaryOrAdmin(authorization))
|
||||||
return new UnauthorizedResponse<>(null);
|
return new UnauthorizedResponse<>(null);
|
||||||
|
|
||||||
Iterable<User> users = userService.getAll();
|
Iterable<User> users = userService.getAll();
|
||||||
@ -90,24 +90,6 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/students")
|
|
||||||
public ResponseEntity<Iterable<HashMap<String,Object>>> getAllStudent(@RequestHeader("Authorization") String token){
|
|
||||||
if (authServ.getUserFromToken(token) == null)
|
|
||||||
return new UnauthorizedResponse<>(null);
|
|
||||||
|
|
||||||
Iterable<User> teachers = userService.getAllStudents();
|
|
||||||
ArrayList<HashMap<String, Object>> withoutPassword = new ArrayList<>();
|
|
||||||
|
|
||||||
for (User t: teachers){
|
|
||||||
withoutPassword.add(userWithoutPassword(t));
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ResponseEntity<>(withoutPassword, HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** return user's data except password
|
/** return user's data except password
|
||||||
* @param user the user to return
|
* @param user the user to return
|
||||||
|
@ -19,7 +19,4 @@ public interface UserRepository extends CrudRepository<User, Long> {
|
|||||||
@Query("select u from User u where u.role = ovh.herisson.Clyde.Tables.Role.Teacher")
|
@Query("select u from User u where u.role = ovh.herisson.Clyde.Tables.Role.Teacher")
|
||||||
Iterable<User> findAllTeachers();
|
Iterable<User> findAllTeachers();
|
||||||
|
|
||||||
|
|
||||||
@Query("select u from User u where u.role = ovh.herisson.Clyde.Tables.Role.Student")
|
|
||||||
Iterable<User> findAllStudents();
|
|
||||||
}
|
}
|
@ -107,6 +107,4 @@ public class UserService {
|
|||||||
|
|
||||||
|
|
||||||
public Iterable<User> getAllTeachers (){return userRepo.findAllTeachers();}
|
public Iterable<User> getAllTeachers (){return userRepo.findAllTeachers();}
|
||||||
|
|
||||||
public Iterable<User> getAllStudents(){return userRepo.findAllStudents();}
|
|
||||||
}
|
}
|
@ -45,9 +45,9 @@ profile.address=Address
|
|||||||
profile.picture=Profile picture
|
profile.picture=Profile picture
|
||||||
profile.change.curriculum=Change curriculum
|
profile.change.curriculum=Change curriculum
|
||||||
name=Name
|
name=Name
|
||||||
Teacher=Teacher
|
teacher=Teacher
|
||||||
Student=Student
|
student=Student
|
||||||
Secretary=Secretary
|
secretary=Secretary
|
||||||
Curriculum=curriculum
|
curriculum=curriculum
|
||||||
Credits=Credits
|
credits=Credits
|
||||||
faculty=Faculty
|
faculty=Faculty
|
||||||
|
@ -45,9 +45,9 @@ profile.address=Adresse
|
|||||||
profile.picture=Photo de profil
|
profile.picture=Photo de profil
|
||||||
profile.change.curriculum=Changer cursus
|
profile.change.curriculum=Changer cursus
|
||||||
name=Nom
|
name=Nom
|
||||||
Teacher=Enseignant
|
teacher=Enseignant
|
||||||
Student=Etudiant
|
student=Etudiant
|
||||||
Secretary=Secrétaire
|
secretary=Secrétaire
|
||||||
Curriculum=Cursus
|
curriculum=Cursus
|
||||||
Credits=Credits
|
credits=Credits
|
||||||
faculty=Faculté
|
faculty=Faculté
|
||||||
|
@ -1,17 +1,72 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import i18n from "@/i18n.js"
|
import i18n from "@/i18n.js"
|
||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { getStudents } from '../rest/Users.js'
|
|
||||||
|
|
||||||
const users = await getStudents();
|
const users =[{
|
||||||
console.log(users)
|
status: "Inscrit",
|
||||||
|
profilPicture:"/Clyde.png",
|
||||||
|
lastName:"Ghost",
|
||||||
|
firstName:"Clyde",
|
||||||
|
role:"student",
|
||||||
|
address: "Radiator Springs",
|
||||||
|
email:"ClydeGhost@gmail.com",
|
||||||
|
cursus:[
|
||||||
|
{
|
||||||
|
"id": 12,
|
||||||
|
"name": "Math pour l'info",
|
||||||
|
"credits": 11,
|
||||||
|
"faculty": "science",
|
||||||
|
"teacher": 42,
|
||||||
|
"Assistants": []},
|
||||||
|
{
|
||||||
|
"id": 42,
|
||||||
|
"name": "Fonctionnement des ordinateurs",
|
||||||
|
"credits": 11,
|
||||||
|
"faculty": "science",
|
||||||
|
"teacher": 42,
|
||||||
|
"Assistants": []},
|
||||||
|
|
||||||
|
],
|
||||||
|
option:"IT",
|
||||||
|
degree:"BAC1",
|
||||||
|
password:"CeciEstUnMotDePasse123",},
|
||||||
|
{
|
||||||
|
status: "En attente",
|
||||||
|
profilPicture:"/Clyde.png",
|
||||||
|
lastName:"Ghost",
|
||||||
|
firstName:"Clyde",
|
||||||
|
role:"student",
|
||||||
|
address: "Radiator Springs",
|
||||||
|
email:"ClydeGhost@gmail.com",
|
||||||
|
cursus:[
|
||||||
|
{
|
||||||
|
"id": 12,
|
||||||
|
"name": "Math pour l'info",
|
||||||
|
"credits": 11,
|
||||||
|
"faculty": "science",
|
||||||
|
"teacher": 42,
|
||||||
|
"Assistants": []},
|
||||||
|
{
|
||||||
|
"id": 42,
|
||||||
|
"name": "Fonctionnement des ordinateurs",
|
||||||
|
"credits": 11,
|
||||||
|
"faculty": "science",
|
||||||
|
"teacher": 42,
|
||||||
|
"Assistants": []},
|
||||||
|
|
||||||
|
],
|
||||||
|
option:"IT",
|
||||||
|
degree:"BAC1",
|
||||||
|
password:"CeciEstUnMotDePasse123",
|
||||||
|
}]
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div v-for="item in users">
|
<div v-for="item in users">
|
||||||
<div class="bodu">
|
<div class="bodu">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="status"><a style="margin-left:30px">{{item.status}}</a></div>
|
<div class="status"><a style="margin-left:30px">{{item.status}}</a></div>
|
||||||
<div class="option"><a>{{item.role}}</a></div>
|
<div class="option"><a>{{item.option}}</a></div>
|
||||||
<div class="surname"><a>{{item.lastName}}</a></div>
|
<div class="surname"><a>{{item.lastName}}</a></div>
|
||||||
<div class="firstname"><a>{{item.firstName}}</a></div>
|
<div class="firstname"><a>{{item.firstName}}</a></div>
|
||||||
<div class="infos"><button style="background-color:rgb(105,05,105);" >{{i18n("request.moreInfos")}} </button></div>
|
<div class="infos"><button style="background-color:rgb(105,05,105);" >{{i18n("request.moreInfos")}} </button></div>
|
||||||
|
@ -6,13 +6,12 @@
|
|||||||
|
|
||||||
const users = await getAllUsers();
|
const users = await getAllUsers();
|
||||||
|
|
||||||
console.log(users);
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div v-for="item in users">
|
<div v-for="item in users">
|
||||||
<div class="bodu">
|
<div class="bodu">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="role"><a style="margin-left:30px">{{i18n(item.role)}}</a></div>
|
<div class="role"><a style="margin-left:30px">{{i18n(item.role).toUpperCase()}}</a></div>
|
||||||
<div class="surname"><a>{{item.lastName}}</a></div>
|
<div class="surname"><a>{{item.lastName}}</a></div>
|
||||||
<div class="firstname"><a>{{item.firstName}}</a></div>
|
<div class="firstname"><a>{{item.firstName}}</a></div>
|
||||||
<div class="infos"><button style="background-color:rgb(105,05,105);" >{{i18n("request.moreInfos")}} </button></div>
|
<div class="infos"><button style="background-color:rgb(105,05,105);" >{{i18n("request.moreInfos")}} </button></div>
|
||||||
|
@ -112,12 +112,12 @@ export async function getAllUsers(){
|
|||||||
* - role
|
* - role
|
||||||
*/
|
*/
|
||||||
export async function getTeachers(){
|
export async function getTeachers(){
|
||||||
return restGet("/teachers")
|
return restGet("/users/teacher")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function getStudents(){
|
export async function getStudents(){
|
||||||
return restGet("/students")
|
return restGet("/users/student")
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get informations about yourself
|
* Get informations about yourself
|
||||||
|
Loading…
Reference in New Issue
Block a user