Merge remote-tracking branch 'origin/dev-1.1-patch-1' into development

Conflicts:
	src/main/java/ch/ethz/seb/sebserver/gbl/model/session/ClientInstruction.java
	src/main/java/ch/ethz/seb/sebserver/webservice/weblayer/api/ExamProctoringController.java
This commit is contained in:
anhefti 2021-05-12 17:37:08 +02:00
commit 0bda2cb292
3 changed files with 25 additions and 10 deletions

View file

@ -64,7 +64,7 @@ public final class ClientInstruction {
public static final String JITSI_RECEIVE_AUDIO = "jitsiMeetReceiveAudio"; public static final String JITSI_RECEIVE_AUDIO = "jitsiMeetReceiveAudio";
public static final String JITSI_RECEIVE_VIDEO = "jitsiMeetReceiveVideo"; public static final String JITSI_RECEIVE_VIDEO = "jitsiMeetReceiveVideo";
public static final String JITSI_ALLOW_CHAT = "jitsiMeetFeatureFlagChat"; public static final String JITSI_ALLOW_CHAT = "jitsiMeetFeatureFlagChat";
public static final String JITSI_PIN_USER_ID = "jitsiMeetPinUser";
public static final String ZOOM_RECEIVE_AUDIO = "zoomReceiveAudio"; public static final String ZOOM_RECEIVE_AUDIO = "zoomReceiveAudio";
public static final String ZOOM_RECEIVE_VIDEO = "zoomReceiveVideo"; public static final String ZOOM_RECEIVE_VIDEO = "zoomReceiveVideo";
public static final String ZOOM_ALLOW_CHAT = "zoomFeatureFlagChat"; public static final String ZOOM_ALLOW_CHAT = "zoomFeatureFlagChat";

View file

@ -22,6 +22,7 @@ import java.util.stream.Collectors;
import javax.crypto.Mac; import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -206,11 +207,25 @@ public class JitsiProctoringService implements ExamProctoringService {
@Override @Override
public Map<String, String> getInstructionAttributes(final Map<String, String> attributes) { public Map<String, String> getInstructionAttributes(final Map<String, String> attributes) {
return attributes.entrySet().stream() final Map<String, String> result = attributes
.entrySet()
.stream()
.map(entry -> new Tuple<>( .map(entry -> new Tuple<>(
SEB_API_NAME_INSTRUCTION_NAME_MAPPING.getOrDefault(entry.getKey(), entry.getKey()), SEB_API_NAME_INSTRUCTION_NAME_MAPPING.getOrDefault(entry.getKey(), entry.getKey()),
entry.getValue())) entry.getValue()))
.collect(Collectors.toMap(Tuple::get_1, Tuple::get_2)); .collect(Collectors.toMap(Tuple::get_1, Tuple::get_2));
if (BooleanUtils.isTrue(Boolean.valueOf(attributes.get(API.EXAM_PROCTORING_ATTR_RECEIVE_VIDEO)))) {
final String username = this.authorizationService
.getUserService()
.getCurrentUser()
.getUsername();
attributes.put(
ClientInstruction.SEB_INSTRUCTION_ATTRIBUTES.SEB_RECONFIGURE_SETTINGS.JITSI_PIN_USER_ID,
username);
}
return result;
} }
@Override @Override

View file

@ -47,18 +47,18 @@ public class ExamProctoringController {
private final ExamProctoringRoomService examProcotringRoomService; private final ExamProctoringRoomService examProcotringRoomService;
private final ExamAdminService examAdminService; private final ExamAdminService examAdminService;
private final AuthorizationService authorization; private final AuthorizationService authorizationService;
private final ExamSessionService examSessionService; private final ExamSessionService examSessionService;
public ExamProctoringController( public ExamProctoringController(
final ExamProctoringRoomService examProcotringRoomService, final ExamProctoringRoomService examProcotringRoomService,
final ExamAdminService examAdminService, final ExamAdminService examAdminService,
final AuthorizationService authorization, final AuthorizationService authorizationService,
final ExamSessionService examSessionService) { final ExamSessionService examSessionService) {
this.examProcotringRoomService = examProcotringRoomService; this.examProcotringRoomService = examProcotringRoomService;
this.examAdminService = examAdminService; this.examAdminService = examAdminService;
this.authorization = authorization; this.authorizationService = authorizationService;
this.examSessionService = examSessionService; this.examSessionService = examSessionService;
} }
@ -69,7 +69,7 @@ public class ExamProctoringController {
* See also UserService.addUsersInstitutionDefaultPropertySupport */ * See also UserService.addUsersInstitutionDefaultPropertySupport */
@InitBinder @InitBinder
public void initBinder(final WebDataBinder binder) { public void initBinder(final WebDataBinder binder) {
this.authorization this.authorizationService
.getUserService() .getUserService()
.addUsersInstitutionDefaultPropertySupport(binder); .addUsersInstitutionDefaultPropertySupport(binder);
} }
@ -110,7 +110,7 @@ public class ExamProctoringController {
checkAccess(institutionId, examId); checkAccess(institutionId, examId);
return this.examSessionService.getRunningExam(examId) return this.examSessionService.getRunningExam(examId)
.flatMap(this.authorization::checkRead) .flatMap(this.authorizationService::checkRead)
.flatMap(exam -> this.examAdminService.getExamProctoringService(exam.id)) .flatMap(exam -> this.examAdminService.getExamProctoringService(exam.id))
.flatMap(service -> service.getProctorRoomConnection( .flatMap(service -> service.getProctorRoomConnection(
this.examAdminService.getProctoringServiceSettings(examId).getOrThrow(), this.examAdminService.getProctoringServiceSettings(examId).getOrThrow(),
@ -290,19 +290,19 @@ public class ExamProctoringController {
} }
private void checkExamReadAccess(final Long institutionId) { private void checkExamReadAccess(final Long institutionId) {
this.authorization.check( this.authorizationService.check(
PrivilegeType.READ, PrivilegeType.READ,
EntityType.EXAM, EntityType.EXAM,
institutionId); institutionId);
} }
private void checkAccess(final Long institutionId, final Long examId) { private void checkAccess(final Long institutionId, final Long examId) {
this.authorization.check( this.authorizationService.check(
PrivilegeType.READ, PrivilegeType.READ,
EntityType.EXAM, EntityType.EXAM,
institutionId); institutionId);
this.authorization.checkRead(this.examSessionService this.authorizationService.checkRead(this.examSessionService
.getExamDAO() .getExamDAO()
.byPK(examId) .byPK(examId)
.getOrThrow()); .getOrThrow());