bigbluebutton-Github/bigbluebutton-html5/imports/api/annotations/server/handlers/whiteboardAnnotations.js
Pedro Beschorner Marin 381c5cb15c Isolated whiteboard access
Modified the previous implementation of the whiteboard individual access to remove
multiple Collections dependency on this feature. Multi-user whiteboard is now an
array instead of a boolean value and most of the access control can be synchronized
and handled by akka-apps.
2021-03-16 19:55:25 -03:00

32 lines
992 B
JavaScript
Executable File

import _ from 'lodash';
import { check } from 'meteor/check';
import modifyWhiteboardAccess from '/imports/api/whiteboard-multi-user/server/modifiers/modifyWhiteboardAccess';
import clearAnnotations from '../modifiers/clearAnnotations';
import addAnnotation from '../modifiers/addAnnotation';
export default function handleWhiteboardAnnotations({ header, body }, meetingId) {
check(header, Object);
if (header.userId !== 'nodeJSapp') { return false; }
check(meetingId, String);
check(body, Object);
const { annotations, whiteboardId, multiUser } = body;
check(annotations, Array);
check(whiteboardId, String);
check(multiUser, Array);
clearAnnotations(meetingId, whiteboardId);
const annotationsAdded = [];
_.each(annotations, (annotation) => {
const { wbId, userId } = annotation;
annotationsAdded.push(addAnnotation(meetingId, wbId, userId, annotation));
});
modifyWhiteboardAccess(meetingId, whiteboardId, multiUser);
return annotationsAdded;
}