2017-09-12 03:11:03 +08:00
|
|
|
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) => {
|
2017-09-12 03:11:03 +08:00
|
|
|
if (err) {
|
|
|
|
return Logger.error(`Changing meeting={${meetingId}} lock settings: ${err}`);
|
|
|
|
}
|
2017-09-18 09:58:37 +08:00
|
|
|
|
|
|
|
if (numChanged) {
|
|
|
|
return Logger.error(`Changed meeting={${meetingId}} updated lock settings`);
|
|
|
|
}
|
2017-09-12 03:11:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
return Meetings.upsert(selector, modifier, cb);
|
|
|
|
}
|