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

27 lines
1001 B
JavaScript
Raw Normal View History

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;
2020-11-24 23:13:09 +08:00
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);