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

28 lines
996 B
JavaScript
Raw Normal View History

import WhiteboardMultiUser from '/imports/api/whiteboard-multi-user/';
import { Meteor } from 'meteor/meteor';
import Logger from '/imports/startup/server/logger';
import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation';
function whiteboardMultiUser() {
const tokenValidation = AuthTokenValidation.findOne({ connectionId: this.connection.id });
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
Logger.warn(`Publishing WhiteboardMultiUser was requested by unauth connection ${this.connection.id}`);
return WhiteboardMultiUser.find({ meetingId: '' });
}
const { meetingId, userId } = tokenValidation;
2020-11-24 23:13:09 +08:00
Logger.debug('Publishing WhiteboardMultiUser', { meetingId, userId });
return WhiteboardMultiUser.find({ meetingId });
}
function publish(...args) {
const boundMultiUser = whiteboardMultiUser.bind(this);
return boundMultiUser(...args);
}
Meteor.publish('whiteboard-multi-user', publish);