bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/methods/removeUser.js

31 lines
958 B
JavaScript
Raw Normal View History

2017-02-07 23:29:27 +08:00
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import RedisPubSub from '/imports/startup/server/redis';
import { extractCredentials } from '/imports/api/common/server/helpers';
2021-05-06 00:47:43 +08:00
import Logger from '/imports/startup/server/logger';
export default function removeUser(userId, banUser) {
2021-05-06 00:47:43 +08:00
try {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'EjectUserFromMeetingCmdMsg';
2021-05-06 00:47:43 +08:00
const { meetingId, requesterUserId: ejectedBy } = extractCredentials(this.userId);
2021-05-06 00:47:43 +08:00
check(meetingId, String);
check(ejectedBy, String);
check(userId, String);
check(banUser, Boolean);
2021-05-06 00:47:43 +08:00
const payload = {
userId,
ejectedBy,
banUser,
};
2021-05-06 00:47:43 +08:00
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, ejectedBy, payload);
} catch (err) {
Logger.error(`Exception while invoking method removeUser ${err.stack}`);
}
}