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

42 lines
992 B
JavaScript
Raw Normal View History

import Logger from '/imports/startup/server/logger';
import Meetings from '/imports/api/2.0/meetings';
import { check } from 'meteor/check';
export default function changeLockSettings(meetingId, payload) {
check(meetingId, String);
check(payload, {
disableCam: Boolean,
disableMic: Boolean,
disablePrivChat: Boolean,
disablePubChat: Boolean,
lockedLayout: Boolean,
lockOnJoin: Boolean,
lockOnJoinConfigurable: Boolean,
setBy: String,
});
const selector = {
meetingId,
};
const modifier = {
$set: {
lockSettingsProp: payload,
},
};
2017-09-18 09:58:37 +08:00
const cb = (err, numChanged) => {
if (err) {
return Logger.error(`Changing meeting={${meetingId}} lock settings: ${err}`);
}
2017-09-18 09:58:37 +08:00
2017-09-21 05:05:17 +08:00
if (!numChanged) {
return Logger.info(`meeting={${meetingId}} lock settings were not updated`);
2017-09-18 09:58:37 +08:00
}
2017-09-21 05:05:17 +08:00
return Logger.info(`Changed meeting={${meetingId}} updated lock settings`);
};
return Meetings.upsert(selector, modifier, cb);
}