bigbluebutton-Github/bigbluebutton-html5/imports/api/presentation-upload-token/server/publishers.js
2020-02-07 17:11:06 -05:00

33 lines
994 B
JavaScript

import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import PresentationUploadToken from '/imports/api/presentation-upload-token';
import Logger from '/imports/startup/server/logger';
import { extractCredentials } from '/imports/api/common/server/helpers';
function presentationUploadToken(podId, filename) {
if (!this.userId) {
return PresentationUploadToken.find({ meetingId: '' });
}
const { meetingId, requesterUserId } = extractCredentials(this.userId);
check(podId, String);
check(filename, String);
const selector = {
meetingId,
podId,
userId: requesterUserId,
filename,
};
Logger.debug(`Publishing PresentationUploadToken for ${meetingId} ${requesterUserId}`);
return PresentationUploadToken.find(selector);
}
function publish(...args) {
const boundPresentationUploadToken = presentationUploadToken.bind(this);
return boundPresentationUploadToken(...args);
}
Meteor.publish('presentation-upload-token', publish);