bigbluebutton-Github/bigbluebutton-html5/imports/api/presentations/server/publishers.js
2020-11-24 15:13:09 +00:00

27 lines
943 B
JavaScript

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