Compare commits
No commits in common. "7e7cec2f6ca3fe427ec709cbba5a929eff62de43" and "19b4950be4d8ab909109ac377ce92a852df38ce4" have entirely different histories.
7e7cec2f6c
...
19b4950be4
@ -40,16 +40,6 @@ public class UserController {
|
|||||||
return new ResponseEntity<>(ProtectionService.userWithoutPassword(user), HttpStatus.OK);
|
return new ResponseEntity<>(ProtectionService.userWithoutPassword(user), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/user/{id}")
|
|
||||||
public ResponseEntity<HashMap<String ,Object>> getUserById(@RequestHeader("Authorization") String token, @PathVariable Long id){
|
|
||||||
|
|
||||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary,Role.InscriptionService},token))
|
|
||||||
return new UnauthorizedResponse<>(null);
|
|
||||||
|
|
||||||
return new ResponseEntity<>(ProtectionService.userWithoutPassword(userService.getUserById(id)), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/user")
|
@PostMapping("/user")
|
||||||
public ResponseEntity<Map<String ,Object>> postUser(@RequestBody User user,@RequestHeader("Authorization") String token){
|
public ResponseEntity<Map<String ,Object>> postUser(@RequestBody User user,@RequestHeader("Authorization") String token){
|
||||||
|
|
||||||
|
@ -122,9 +122,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();}
|
public Iterable<User> getAllStudents(){return userRepo.findAllStudents();}
|
||||||
|
|
||||||
|
|
||||||
public User getUserById(long id) {
|
|
||||||
return userRepo.findById(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,11 @@ window.onhashchange = function() {
|
|||||||
prevURL = currentURL;
|
prevURL = currentURL;
|
||||||
currentURL = window.location.hash;
|
currentURL = window.location.hash;
|
||||||
}
|
}
|
||||||
|
console.log(location)
|
||||||
window.addEventListener('hashchange', () => {
|
window.addEventListener('hashchange', () => {
|
||||||
|
console.log(prevURL)
|
||||||
|
console.log(location.hash)
|
||||||
|
console.log(isLogged())
|
||||||
if(location.hash === "#/home" && prevURL === "#/login"){
|
if(location.hash === "#/home" && prevURL === "#/login"){
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import i18n from "@/i18n.js"
|
import i18n from "@/i18n.js"
|
||||||
import {ref} from 'vue'
|
import {ref} from 'vue'
|
||||||
import { getCourses,deleteCourse,alterCourse,createCourse } from "@/rest/courses.js"
|
import { getCourses,deleteCourse,alterCourse,createCourse } from "@/rest/courses.js"
|
||||||
import {getUser, getSelf, getTeachers } from "@/rest/Users.js"
|
import {getSelf, getTeachers } from "@/rest/Users.js"
|
||||||
|
|
||||||
|
|
||||||
const self = await getSelf();
|
const self = await getSelf();
|
||||||
@ -108,7 +108,7 @@
|
|||||||
<div style="margin-bottom:20px;">
|
<div style="margin-bottom:20px;">
|
||||||
{{i18n("Teacher")}} :
|
{{i18n("Teacher")}} :
|
||||||
<select style="max-width:200px;" class="teacher" v-model="toAdd.owner">
|
<select style="max-width:200px;" class="teacher" v-model="toAdd.owner">
|
||||||
<option v-for="item in profList">{{item}}</option>
|
<option v-for="item in profList">{{item.regNo}}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom:20px;">
|
<div style="margin-bottom:20px;">
|
||||||
|
@ -72,7 +72,7 @@ export async function createUser(firstname, lastname, birthDate, email, address,
|
|||||||
* if the user is not authenticated. then an empty array should be returned
|
* if the user is not authenticated. then an empty array should be returned
|
||||||
*/
|
*/
|
||||||
export async function getUser(id){
|
export async function getUser(id){
|
||||||
const endpoint = "/user/" + id;
|
const endpoint = "/user" + id != null ? "/" + id : "";
|
||||||
return restGet(endpoint);
|
return restGet(endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user