added userid to pin for Jitsi broadcasting instruction

This commit is contained in:
anhefti 2021-05-12 13:39:09 +02:00
parent eaf555ae11
commit d7e52efac9
2 changed files with 20 additions and 8 deletions

View file

@ -52,6 +52,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";
} }
} }

View file

@ -15,6 +15,7 @@ import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
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;
@ -59,20 +60,20 @@ public class ExamProctoringController {
private final ExamProctoringRoomService examProcotringRoomService; private final ExamProctoringRoomService examProcotringRoomService;
private final ExamAdminService examAdminService; private final ExamAdminService examAdminService;
private final SEBClientInstructionService sebInstructionService; private final SEBClientInstructionService sebInstructionService;
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 SEBClientInstructionService sebInstructionService, final SEBClientInstructionService sebInstructionService,
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.sebInstructionService = sebInstructionService; this.sebInstructionService = sebInstructionService;
this.authorization = authorization; this.authorizationService = authorizationService;
this.examSessionService = examSessionService; this.examSessionService = examSessionService;
} }
@ -83,7 +84,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);
} }
@ -123,7 +124,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(this.examAdminService::getExamProctoring) .flatMap(this.examAdminService::getExamProctoring)
.flatMap(proc -> this.examAdminService .flatMap(proc -> this.examAdminService
.getExamProctoringService(proc.serverType) .getExamProctoringService(proc.serverType)
@ -200,6 +201,16 @@ public class ExamProctoringController {
ClientInstruction.SEB_INSTRUCTION_ATTRIBUTES.SEB_RECONFIGURE_SETTINGS.JITSI_ALLOW_CHAT, ClientInstruction.SEB_INSTRUCTION_ATTRIBUTES.SEB_RECONFIGURE_SETTINGS.JITSI_ALLOW_CHAT,
sendAllowChat); sendAllowChat);
if (BooleanUtils.isTrue(Boolean.valueOf(sendReceiveVideo))) {
final String username = this.authorizationService
.getUserService()
.getCurrentUser()
.getUsername();
attributes.put(
ClientInstruction.SEB_INSTRUCTION_ATTRIBUTES.SEB_RECONFIGURE_SETTINGS.JITSI_PIN_USER_ID,
username);
}
sendBroadcastInstructions(examId, roomName, connectionTokens, attributes); sendBroadcastInstructions(examId, roomName, connectionTokens, attributes);
} }
@ -608,19 +619,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());