bigbluebutton-Github/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/userEjected.js

40 lines
820 B
JavaScript
Raw Normal View History

2017-09-22 00:21:42 +08:00
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/2.0/users';
2017-09-22 00:21:42 +08:00
export default function userEjected(meetingId, userId) {
2017-09-22 00:21:42 +08:00
check(meetingId, String);
check(userId, String);
const selector = {
meetingId,
userId,
};
const modifier = {
$set: {
ejected: true,
2017-09-25 23:57:39 +08:00
connectionStatus: 'offline',
listenOnly: false,
validated: false,
emoji: 'none',
presenter: false,
role: 'VIEWER',
2017-09-22 00:21:42 +08:00
},
};
const cb = (err, numChanged) => {
if (err) {
return Logger.error(`Kicking user from collection: ${err}`);
}
if (numChanged) {
return Logger.info(`Kicked user id=${userId} meeting=${meetingId}`);
}
return null;
};
return Users.update(selector, modifier, cb);
}