bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/clearUsers.js
2020-11-24 17:44:13 -03:00

27 lines
657 B
JavaScript

import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/users/index';
export default function clearUsers(meetingId) {
if (meetingId) {
try {
const numberAffected = Users.remove({ meetingId });
if (numberAffected) {
Logger.info(`Cleared Users (${meetingId})`);
}
} catch (err) {
Logger.error(`Error clearing Users (${meetingId}). ${err}`);
}
} else {
try {
const numberAffected = Users.remove({});
if (numberAffected) {
Logger.info('Cleared Users (all)');
}
} catch (err) {
Logger.error(`Error clearing Users (all). ${err}`);
}
}
}