bigbluebutton-Github/bigbluebutton-html5/imports/api/whiteboard-multi-user/server/modifiers/modifyWhiteboardAccess.js

32 lines
919 B
JavaScript
Raw Normal View History

import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import WhiteboardMultiUser from '/imports/api/whiteboard-multi-user/';
2018-04-10 07:18:49 +08:00
export default function modifyWhiteboardAccess(meetingId, whiteboardId, multiUser) {
check(meetingId, String);
2018-04-10 07:18:49 +08:00
check(whiteboardId, String);
check(multiUser, Array);
const selector = {
meetingId,
2018-04-10 07:18:49 +08:00
whiteboardId,
};
const modifier = {
2018-04-10 07:18:49 +08:00
meetingId,
whiteboardId,
multiUser,
};
try {
const { insertedId } = WhiteboardMultiUser.upsert(selector, modifier);
if (insertedId) {
Logger.info(`Added multiUser flag=${multiUser} meetingId=${meetingId} whiteboardId=${whiteboardId}`);
} else {
Logger.info(`Upserted multiUser flag=${multiUser} meetingId=${meetingId} whiteboardId=${whiteboardId}`);
}
} catch (err) {
Logger.error(`Error while adding an entry to Multi-User collection: ${err}`);
}
}