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

67 lines
1.5 KiB
JavaScript
Raw Normal View History

import Logger from '/imports/startup/server/logger';
import Meetings from '/imports/api/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,
disableNotes: Boolean,
hideUserList: Boolean,
lockOnJoin: Boolean,
lockOnJoinConfigurable: Boolean,
hideViewersCursor: Boolean,
setBy: Match.Maybe(String),
});
2019-04-10 21:44:34 +08:00
const {
disableCam,
disableMic,
disablePrivChat,
disablePubChat,
disableNotes,
hideUserList,
2019-04-10 21:44:34 +08:00
lockOnJoin,
lockOnJoinConfigurable,
hideViewersCursor,
2019-04-10 21:44:34 +08:00
setBy,
} = payload;
const selector = {
meetingId,
};
const modifier = {
$set: {
2019-04-10 21:44:34 +08:00
lockSettingsProps: {
disableCam,
disableMic,
disablePrivateChat: disablePrivChat,
disablePublicChat: disablePubChat,
disableNotes,
hideUserList,
2019-04-10 21:44:34 +08:00
lockOnJoin,
lockOnJoinConfigurable,
hideViewersCursor,
2019-04-10 21:44:34 +08:00
setBy,
},
},
};
2017-09-18 09:58:37 +08:00
try {
const { numberAffected } = Meetings.upsert(selector, modifier);
2017-09-21 05:05:17 +08:00
if (numberAffected) {
Logger.info(`Changed meeting={${meetingId}} updated lock settings`);
} else {
Logger.info(`meeting={${meetingId}} lock settings were not updated`);
}
} catch (err) {
Logger.error(`Changing meeting={${meetingId}} lock settings: ${err}`);
}
}