bigbluebutton-Github/bigbluebutton-html5/imports/api/2.0/polls/server/publishers.js

31 lines
783 B
JavaScript
Raw Normal View History

2017-06-29 04:37:45 +08:00
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
2017-06-30 22:26:19 +08:00
import Logger from '/imports/startup/server/logger';
2017-06-29 04:37:45 +08:00
import Polls from '/imports/api/2.0/polls';
import mapToAcl from '/imports/startup/mapToAcl';
function polls(credentials) {
const { meetingId, requesterUserId, requesterToken } = credentials;
check(meetingId, String);
check(requesterUserId, String);
check(requesterToken, String);
2017-06-30 22:26:19 +08:00
Logger.info(`Publishing polls2x =${meetingId} ${requesterUserId} ${requesterToken}`);
2017-06-29 04:37:45 +08:00
const selector = {
meetingId,
users: requesterUserId,
};
return Polls.find(selector);
}
function publish(...args) {
const boundPolls = polls.bind(this);
return mapToAcl('subscriptions.polls', boundPolls)(args);
}
2017-06-30 22:26:19 +08:00
Meteor.publish('polls2x', publish);
2017-06-29 04:37:45 +08:00