bigbluebutton-Github/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/userEjected.js
2017-09-28 10:41:02 -07:00

40 lines
822 B
JavaScript

import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/2.0/users';
export default function userEjected(meetingId, userId) {
check(meetingId, String);
check(userId, String);
const selector = {
meetingId,
userId,
};
const modifier = {
$set: {
ejected: true,
connectionStatus: 'offline',
listenOnly: false,
validated: false,
emoji: 'none',
presenter: false,
role: 'VIEWER',
},
};
const cb = (err, numChanged) => {
if (err) {
return Logger.error(`Ejecting user from collection: ${err}`);
}
if (numChanged) {
return Logger.info(`Ejected user id=${userId} meeting=${meetingId}`);
}
return null;
};
return Users.update(selector, modifier, cb);
}