bigbluebutton-Github/bigbluebutton-html5/imports/api/video-streams/server/methods/ejectUserCameras.js
prlanzarin 21c124b854 feat(webcams): server-side logic to allow moderators to close user's webcams
Includes a new create param/web conf called allowModsToEjectCameras, false by
default.

Ejection does not work in breakout rooms or with non-mod users

Ejection closes _all_ webcams shared by the target user
2021-12-13 19:49:41 +00:00

29 lines
1006 B
JavaScript

import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import RedisPubSub from '/imports/startup/server/redis';
import { extractCredentials } from '/imports/api/common/server/helpers';
export default function ejectUserCameras(userId) {
try {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'EjectUserCamerasCmdMsg';
const { meetingId, requesterUserId } = extractCredentials(this.userId);
check(meetingId, String);
check(requesterUserId, String);
check(userId, String);
Logger.info(`Requesting ejection of cameras: userToEject=${userId} requesterUserId=${requesterUserId}`);
const payload = {
userId,
};
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
} catch (err) {
Logger.error(`Exception while invoking method ejectUserCameras ${err.stack}`);
}
}