bigbluebutton-Github/bigbluebutton-html5/imports/api/meetings/server/modifiers/setGuestPolicy.js

35 lines
793 B
JavaScript
Raw Normal View History

2020-02-04 04:41:12 +08:00
import Meetings from '/imports/api/meetings';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
export default function setGuestPolicy(meetingId, guestPolicy) {
check(meetingId, String);
check(guestPolicy, String);
const selector = {
meetingId,
};
const modifier = {
$set: {
usersProp: {
guestPolicy,
}
},
};
const cb = (err, numChanged) => {
if (err) {
return Logger.error(`Changing meeting guest policy: ${err}`);
}
if (!numChanged) {
return Logger.info(`Meeting's ${meetingId} guest policy=${guestPolicy} wasn't updated`);
}
return Logger.info(`Meeting's ${meetingId} guest policy=${guestPolicy} updated`);
};
return Meetings.update(selector, modifier, cb);
}