use of com.microsoft.graph.models.LobbyBypassSettings in project OpenOLAT by OpenOLAT.
the class MicrosoftGraphDAO method createMeeting.
/**
* The create meeting only use the communications API. To set all
* settings, an update with the "On behalf" user is needed.<br>
* If the create is done with the "On behalf" user, only this user
* can make the group rooms and configure the meeting in the Microsoft
* Teams application. The process create with /communications and update
* with "On behalf" user is a workaround to allow the user to configure
* the meeting in Teams App. and OpenOlat to set a maximum of settings.
*
* @param meeting The meeting
* @param user The user if found
* @param role The role (PRESENTER can be promoted to PRODUCER)
* @param errors Mandatory errors object
* @return An online meeting if successful
*/
public OnlineMeeting createMeeting(TeamsMeeting meeting, User user, OnlineMeetingRole role, TeamsErrors errors) throws ClientException {
MeetingParticipants participants = new MeetingParticipants();
participants.attendees = new ArrayList<>();
if (user != null) {
if (role == OnlineMeetingRole.PRESENTER) {
// Add all possible roles
participants.organizer = createParticipantInfo(user, OnlineMeetingRole.PRESENTER);
participants.attendees.add(createParticipantInfo(user, OnlineMeetingRole.PRESENTER));
log.info("Create Teams Meeting on MS for {}, for role {} and MS user as organizer and presenter {} {}", meeting.getKey(), role, user.id, user.displayName);
} else if (StringHelper.containsNonWhitespace(teamsModule.getProducerId()) && canAttendeeOpenMeeting(meeting)) {
// Attendee can create an online meeting only if they have a chance to enter it
participants.organizer = createParticipantInfo(teamsModule.getProducerId(), OnlineMeetingRole.PRESENTER);
MeetingParticipantInfo infos = createParticipantInfo(user, OnlineMeetingRole.ATTENDEE);
participants.attendees.add(infos);
log.info("Create Teams Meeting on MS for {}, for role {} and MS user as attendee {} {}", meeting.getKey(), role, user.id, user.displayName);
} else {
errors.append(new TeamsError(TeamsErrorCodes.organizerMissing));
return null;
}
} else {
errors.append(new TeamsError(TeamsErrorCodes.organizerMissing));
return null;
}
OnlineMeeting onlineMeeting = new OnlineMeeting();
if (meeting.getStartDate() != null && meeting.getEndDate() != null) {
onlineMeeting.startDateTime = toCalendar(meeting.getStartDate());
onlineMeeting.endDateTime = toCalendar(meeting.getEndDate());
}
onlineMeeting.subject = meeting.getSubject();
onlineMeeting.participants = participants;
onlineMeeting.allowedPresenters = toOnlineMeetingPresenters(meeting.getAllowedPresenters());
LobbyBypassSettings lobbyBypassSettings = new LobbyBypassSettings();
lobbyBypassSettings.isDialInBypassEnabled = Boolean.TRUE;
lobbyBypassSettings.scope = toLobbyBypassScope(meeting.getLobbyBypassScope());
onlineMeeting.lobbyBypassSettings = lobbyBypassSettings;
String joinInformations = meeting.getJoinInformation();
if (StringHelper.containsNonWhitespace(joinInformations)) {
ItemBody body = new ItemBody();
if (StringHelper.isHtml(joinInformations)) {
body.contentType = BodyType.HTML;
} else {
body.contentType = BodyType.TEXT;
}
body.content = "<html><body>" + joinInformations + "</body></html>";
onlineMeeting.joinInformation = body;
}
onlineMeeting = client().communications().onlineMeetings().buildRequest().post(onlineMeeting);
log.info(Tracing.M_AUDIT, "Online-Meeting created (/communications) with id: {}", onlineMeeting.id);
return onlineMeeting;
}
Aggregations