diff --git a/backend/src/main/java/com/edufocus/edufocus/lecture/service/LectureServiceImpl.java b/backend/src/main/java/com/edufocus/edufocus/lecture/service/LectureServiceImpl.java index 98f6535..29e26ad 100644 --- a/backend/src/main/java/com/edufocus/edufocus/lecture/service/LectureServiceImpl.java +++ b/backend/src/main/java/com/edufocus/edufocus/lecture/service/LectureServiceImpl.java @@ -237,9 +237,7 @@ public class LectureServiceImpl implements LectureService { Lecture l; l = lecture.get(); - if (l.isOnline()) { - l.setOnline(false); - } else { + if (l.isOnline() == false) { l.setOnline(true); } diff --git a/backend/src/main/java/com/edufocus/edufocus/video/controller/Controller.java b/backend/src/main/java/com/edufocus/edufocus/video/controller/Controller.java index 0996fa4..cc7bb6c 100644 --- a/backend/src/main/java/com/edufocus/edufocus/video/controller/Controller.java +++ b/backend/src/main/java/com/edufocus/edufocus/video/controller/Controller.java @@ -121,13 +121,16 @@ public class Controller { @PostMapping(value = "/makeroom/{lecture_id}") public ResponseEntity> makeRoom(@PathVariable("lecture_id") Long id, HttpServletRequest request) throws Exception { String userToken = request.getHeader("Authorization"); - - Long userId = Long.parseLong(jwtUtil.getUserId(userToken)); + User findUser = userRepository.findById(userId).orElse(null); + if (findUser.getRole() == UserRole.ADMIN) { - videoSertvice.startOnline(userId, id); + videoSertvice.startOnline(userId, id); + + + } return ResponseEntity.ok(Map.of("token", " ")); diff --git a/backend/src/main/java/com/edufocus/edufocus/video/service/VideoServiceImpl.java b/backend/src/main/java/com/edufocus/edufocus/video/service/VideoServiceImpl.java index 055e133..110de11 100644 --- a/backend/src/main/java/com/edufocus/edufocus/video/service/VideoServiceImpl.java +++ b/backend/src/main/java/com/edufocus/edufocus/video/service/VideoServiceImpl.java @@ -36,7 +36,7 @@ public class VideoServiceImpl implements VideoSertvice { public boolean isRoomAccessible(Long lectureId, Long userId) { - LectureDetailResponse lecture = lectureService.findLectureById(userId, userId); + LectureDetailResponse lecture = lectureService.findLectureById(userId, lectureId); RegistrationStatus registrationStatus = registrationService.getStatus(userId, lectureId);