feat: joinromm 수정:
This commit is contained in:
parent
2a090a3016
commit
77a5aed6ec
@ -95,18 +95,21 @@ public class Controller {
|
|||||||
|
|
||||||
} else if (findUser.getRole() == UserRole.ADMIN) {//&& lecture.isOnline() ) {
|
} else if (findUser.getRole() == UserRole.ADMIN) {//&& lecture.isOnline() ) {
|
||||||
|
|
||||||
|
// 자신의 강의인지 확인하기
|
||||||
IdentityData identityData = new IdentityData(participantName, "강사");
|
if (videoSertvice.checkAdmin(userId, id)) {
|
||||||
String jsonIdentity = serializeIdentityData(identityData);
|
IdentityData identityData = new IdentityData(participantName, "강사");
|
||||||
|
String jsonIdentity = serializeIdentityData(identityData);
|
||||||
|
|
||||||
|
|
||||||
token.setIdentity(jsonIdentity);
|
token.setIdentity(jsonIdentity);
|
||||||
token.setName(participantName);
|
token.setName(participantName);
|
||||||
|
|
||||||
token.addGrants(new RoomJoin(true), new RoomName(roomName), new RoomCreate(true));
|
token.addGrants(new RoomJoin(true), new RoomName(roomName), new RoomCreate(true));
|
||||||
|
|
||||||
|
|
||||||
return ResponseEntity.ok(Map.of("token", token.toJwt()));
|
return ResponseEntity.ok(Map.of("token", token.toJwt()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,4 +10,6 @@ public interface VideoSertvice {
|
|||||||
|
|
||||||
boolean isRoomAccessible(Long lectureId, Long userId);
|
boolean isRoomAccessible(Long lectureId, Long userId);
|
||||||
|
|
||||||
|
boolean checkAdmin(Long userId, Long lectureId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.edufocus.edufocus.video.service;
|
|||||||
|
|
||||||
import com.edufocus.edufocus.lecture.entity.Lecture;
|
import com.edufocus.edufocus.lecture.entity.Lecture;
|
||||||
import com.edufocus.edufocus.lecture.entity.LectureDetailResponse;
|
import com.edufocus.edufocus.lecture.entity.LectureDetailResponse;
|
||||||
|
import com.edufocus.edufocus.lecture.entity.LectureSearchResponse;
|
||||||
import com.edufocus.edufocus.lecture.service.LectureService;
|
import com.edufocus.edufocus.lecture.service.LectureService;
|
||||||
import com.edufocus.edufocus.registration.entity.RegistrationStatus;
|
import com.edufocus.edufocus.registration.entity.RegistrationStatus;
|
||||||
import com.edufocus.edufocus.registration.service.RegistrationService;
|
import com.edufocus.edufocus.registration.service.RegistrationService;
|
||||||
@ -10,6 +11,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional
|
@Transactional
|
||||||
@ -46,4 +48,17 @@ public class VideoServiceImpl implements VideoSertvice {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkAdmin(Long userId, Long lectureId) {
|
||||||
|
// 강의가 내 강의인지 확인
|
||||||
|
List<LectureSearchResponse> lecture = lectureService.findMyLecture(userId);
|
||||||
|
|
||||||
|
for (LectureSearchResponse l : lecture) {
|
||||||
|
if (l.getId() == lectureId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user