bigbluebutton-Github/bigbluebutton-html5/imports/api/presentation-pods/server/publishers.js

27 lines
1001 B
JavaScript

import { Meteor } from 'meteor/meteor';
import PresentationPods from '/imports/api/presentation-pods';
import Logger from '/imports/startup/server/logger';
import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation';
async function presentationPods() {
const tokenValidation = await AuthTokenValidation
.findOneAsync({ connectionId: this.connection.id });
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
Logger.warn(`Publishing PresentationPods was requested by unauth connection ${this.connection.id}`);
return PresentationPods.find({ meetingId: '' });
}
const { meetingId, userId } = tokenValidation;
Logger.debug('Publishing presentation-pods', { meetingId, userId });
return PresentationPods.find({ meetingId });
}
function publish(...args) {
const boundPresentationPods = presentationPods.bind(this);
return boundPresentationPods(...args);
}
Meteor.publish('presentation-pods', publish);