Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SAK-50492: Allow instructors to be co-organizers in an online meeting #29

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@
import java.time.Instant;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.Set;
import java.util.List;
import java.util.Collections;
import java.util.Collection;
import java.util.stream.Collectors;

import org.apache.commons.lang3.StringUtils;
import org.sakaiproject.authz.api.Member;
import org.sakaiproject.authz.api.SecurityService;
import org.sakaiproject.exception.IdUnusedException;
import org.sakaiproject.meetings.api.MeetingService;
import org.sakaiproject.meetings.api.model.AttendeeType;
Expand Down Expand Up @@ -84,6 +85,9 @@ public class MeetingsController {

@Autowired
private MicrosoftCommonService microsoftCommonService;

@Autowired
private SecurityService securityService;

@Autowired
private MicrosoftSynchronizationService microsoftSynchronizationService;
Expand Down Expand Up @@ -390,8 +394,26 @@ public Meeting createMeeting(@RequestBody MeetingData data) throws MeetingsExcep
// Online meeting creation with the selected provider
String onlineMeetingId = null;
String onlineMeetingUrl = null;
List<String> coorganizerEmails = new ArrayList<>();
if (MS_TEAMS.equals(data.getProvider())) {
TeamsMeetingData meetingTeams = microsoftCommonService.createOnlineMeeting(user.getEmail(), meeting.getTitle(), meeting.getStartDate(), meeting.getEndDate());
if (data.isCoorganizersEnabled()) {
List<Member> coorganizers = sakaiProxy.getSite(data.getSiteId()).getMembers()
.stream()
.filter(u -> {
boolean canUpdate = sakaiProxy.canUpdateSite("/site/" + data.getSiteId(), u.getUserId());
log.debug("User: " + u.getUserId() + " canUpdate: " + canUpdate);
return canUpdate;
})
.collect(Collectors.toList());

coorganizers.forEach(c -> log.debug("Filtered Coorganizer: " + c.getUserId()));

coorganizerEmails = coorganizers.stream()
.map(member -> sakaiProxy.getUser(member.getUserId()).getEmail())
.filter(StringUtils::isNotEmpty)
.collect(Collectors.toList());
}
TeamsMeetingData meetingTeams = microsoftCommonService.createOnlineMeeting(user.getEmail(), meeting.getTitle(), meeting.getStartDate(), meeting.getEndDate(), coorganizerEmails);
onlineMeetingUrl = meetingTeams.getJoinUrl();
onlineMeetingId = meetingTeams.getId();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ public class MeetingData implements Serializable {
private AttendeeType participantOption;
private List<String> groupSelection;
private List<ParticipantData> participants;

private boolean coorganizersEnabled;
}
1 change: 1 addition & 0 deletions meetings/tool/src/main/resources/create-meeting.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ no_notification=None - No notification
notifications=Notifications
open_date=Open Date
participants_selection=Participants selection
enable_coorganizers= Add site instructors as co-organizers
save=Save
section_availability=3. Availability
section_meeting_information=1. Meeting Information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ no_notification=No - Sense notificaci\u00F3
notifications=Notificacions
open_date=Data d\u2019inici
participants_selection=Selecci\u00F3 de participants
enable_coorganizers= Afegiu instructors del lloc com a coorganitzadors
save=Desa
section_availability=3. Disponibilitat
section_meeting_information=1. Dades de la reuni\u00F3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ ms_teams=Microsoft Teams
no_notification=No - Sin notificaci\u00F3n
notifications=Notificaciones
open_date=Fecha de inicio
participants_selection=Selecci\u00F3n de participantes
participants_selection=Selecci\u00f3n de participantes
enable_coorganizers= A�ada instructores del sitio como coorganizadores
save=Guardar
section_availability=3. Disponibilidad
section_meeting_information=1. Datos de la reuni\u00F3n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ no_notification= Bat ere ez - Jakinarazpenik gabe
notifications= Jakinarazpenak
open_date= Hasteko data
participants_selection= Partaideen hautaketa
enable_coorganizers= Gehitu guneko irakasleak ko-antolatzaile gisa
save= Gorde
section_availability= 3. Erabilgarritasuna
section_meeting_information= 1. Bilerari buruzko informazioa
Expand Down
15 changes: 15 additions & 0 deletions meetings/ui/src/main/frontend/src/views/CreateMeeting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@
{{this.i18n.info_no_groups}}
</div>
</div>
<div class="mt-3">
<div class="form-check">
<input
class="form-check-input"
type="checkbox"
id="enableCoorganizers"
v-model="formdata.enableCoorganizers"
/>
<label class="form-check-label" for="enableCoorganizers">
{{ i18n.enable_coorganizers }}
</label>
</div>
</div>
</SakaiAccordionItem>
<SakaiAccordionItem :title="i18n.section_availability">
<div class="col-md-6 col-xl-4 pb-4">
Expand Down Expand Up @@ -172,6 +185,7 @@ export default {
notificationType: "0",
groups: [],
participantOption: "SITE",
enableCoorganizers: false
},
groups: [],
participants: [],
Expand Down Expand Up @@ -248,6 +262,7 @@ export default {
participantOption: (this.formdata.participantOption === 'SITE' ? 1 : 2),
groupSelection: this.formdata.groups,
provider: this.formdata.confService,
coorganizersEnabled: this.formdata.enableCoorganizers
};
let methodToCall = constants.toolPlacement;
let restMethod = "POST";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public static enum PermissionRoles { READ, WRITE }
boolean removeMemberFromChannel(String memberId, String teamId, String channelId) throws MicrosoftCredentialsException;

// ---------------------------------------- ONLINE MEETINGS --------------------------------------------------
TeamsMeetingData createOnlineMeeting(String userEmail, String subject, Instant startDate, Instant endDate) throws MicrosoftCredentialsException;
TeamsMeetingData createOnlineMeeting(String userEmail, String subject, Instant startDate, Instant endDate, List<String> coorganizerEmails) throws MicrosoftCredentialsException;
void updateOnlineMeeting(String userEmail, String meetingId, String subject, Instant startDate, Instant endDate) throws MicrosoftCredentialsException;
List<MeetingRecordingData> getOnlineMeetingRecordings(String onlineMeetingId, List<String> teamIdsList, boolean force) throws MicrosoftCredentialsException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ public boolean removeMemberFromChannel(String memberId, String teamId, String ch
* @param endDate
* @return
*/
public TeamsMeetingData createOnlineMeeting(String userEmail, String subject, Instant startDate, Instant endDate) throws MicrosoftCredentialsException {
public TeamsMeetingData createOnlineMeeting(String userEmail, String subject, Instant startDate, Instant endDate, List<String> coorganizerEmails) throws MicrosoftCredentialsException {
TeamsMeetingData result = null;

// Get organizer user
Expand All @@ -1689,6 +1689,29 @@ public TeamsMeetingData createOnlineMeeting(String userEmail, String subject, In
MeetingParticipants participants = new MeetingParticipants();
participants.organizer = organizer;

// Coorganizers
List<MeetingParticipantInfo> attendees = new ArrayList<>();
if (coorganizerEmails != null) {
for (String coorganizerEmail : coorganizerEmails) {
if (!coorganizerEmail.equals(organizerUser.getEmail())) {
MicrosoftUser coorganizerUser = getUserByEmail(coorganizerEmail);
if (coorganizerUser != null) {
MeetingParticipantInfo coorganizer = new MeetingParticipantInfo();
IdentitySet coorganizerIdentity = new IdentitySet();
Identity coorganizerIden = new Identity();
coorganizerIden.id = coorganizerUser.getId();
coorganizerIden.displayName = coorganizerUser.getName();
coorganizerIdentity.user = coorganizerIden;
coorganizer.identity = coorganizerIdentity;
coorganizer.role = OnlineMeetingRole.COORGANIZER;
attendees.add(coorganizer);
}
}
}
}
participants.attendees = attendees;


// Lobby Settings
LobbyBypassSettings lobbySettings = new LobbyBypassSettings();
lobbySettings.scope = LobbyBypassScope.ORGANIZATION;
Expand Down
Loading