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:
commit
0bda2cb292
3 changed files with 25 additions and 10 deletions
|
@ -64,7 +64,7 @@ public final class ClientInstruction {
|
|||
public static final String JITSI_RECEIVE_AUDIO = "jitsiMeetReceiveAudio";
|
||||
public static final String JITSI_RECEIVE_VIDEO = "jitsiMeetReceiveVideo";
|
||||
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_VIDEO = "zoomReceiveVideo";
|
||||
public static final String ZOOM_ALLOW_CHAT = "zoomFeatureFlagChat";
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.stream.Collectors;
|
|||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -206,11 +207,25 @@ public class JitsiProctoringService implements ExamProctoringService {
|
|||
|
||||
@Override
|
||||
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<>(
|
||||
SEB_API_NAME_INSTRUCTION_NAME_MAPPING.getOrDefault(entry.getKey(), entry.getKey()),
|
||||
entry.getValue()))
|
||||
.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
|
||||
|
|
|
@ -47,18 +47,18 @@ public class ExamProctoringController {
|
|||
|
||||
private final ExamProctoringRoomService examProcotringRoomService;
|
||||
private final ExamAdminService examAdminService;
|
||||
private final AuthorizationService authorization;
|
||||
private final AuthorizationService authorizationService;
|
||||
private final ExamSessionService examSessionService;
|
||||
|
||||
public ExamProctoringController(
|
||||
final ExamProctoringRoomService examProcotringRoomService,
|
||||
final ExamAdminService examAdminService,
|
||||
final AuthorizationService authorization,
|
||||
final AuthorizationService authorizationService,
|
||||
final ExamSessionService examSessionService) {
|
||||
|
||||
this.examProcotringRoomService = examProcotringRoomService;
|
||||
this.examAdminService = examAdminService;
|
||||
this.authorization = authorization;
|
||||
this.authorizationService = authorizationService;
|
||||
this.examSessionService = examSessionService;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class ExamProctoringController {
|
|||
* See also UserService.addUsersInstitutionDefaultPropertySupport */
|
||||
@InitBinder
|
||||
public void initBinder(final WebDataBinder binder) {
|
||||
this.authorization
|
||||
this.authorizationService
|
||||
.getUserService()
|
||||
.addUsersInstitutionDefaultPropertySupport(binder);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class ExamProctoringController {
|
|||
|
||||
checkAccess(institutionId, examId);
|
||||
return this.examSessionService.getRunningExam(examId)
|
||||
.flatMap(this.authorization::checkRead)
|
||||
.flatMap(this.authorizationService::checkRead)
|
||||
.flatMap(exam -> this.examAdminService.getExamProctoringService(exam.id))
|
||||
.flatMap(service -> service.getProctorRoomConnection(
|
||||
this.examAdminService.getProctoringServiceSettings(examId).getOrThrow(),
|
||||
|
@ -290,19 +290,19 @@ public class ExamProctoringController {
|
|||
}
|
||||
|
||||
private void checkExamReadAccess(final Long institutionId) {
|
||||
this.authorization.check(
|
||||
this.authorizationService.check(
|
||||
PrivilegeType.READ,
|
||||
EntityType.EXAM,
|
||||
institutionId);
|
||||
}
|
||||
|
||||
private void checkAccess(final Long institutionId, final Long examId) {
|
||||
this.authorization.check(
|
||||
this.authorizationService.check(
|
||||
PrivilegeType.READ,
|
||||
EntityType.EXAM,
|
||||
institutionId);
|
||||
|
||||
this.authorization.checkRead(this.examSessionService
|
||||
this.authorizationService.checkRead(this.examSessionService
|
||||
.getExamDAO()
|
||||
.byPK(examId)
|
||||
.getOrThrow());
|
||||
|
|
Loading…
Reference in a new issue