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

31 lines
775 B
JavaScript
Raw Normal View History

2016-10-21 21:21:09 +08:00
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
2017-10-12 08:33:57 +08:00
import Logger from '/imports/startup/server/logger';
import Polls from '/imports/api/polls';
2017-06-01 01:54:43 +08:00
import mapToAcl from '/imports/startup/mapToAcl';
2016-10-21 21:21:09 +08:00
2017-06-01 01:54:43 +08:00
function polls(credentials) {
2016-10-21 21:21:09 +08:00
const { meetingId, requesterUserId, requesterToken } = credentials;
check(meetingId, String);
check(requesterUserId, String);
check(requesterToken, String);
Logger.info(`Publishing polls =${meetingId} ${requesterUserId} ${requesterToken}`);
2017-10-12 08:33:57 +08:00
const selector = {
2017-06-03 03:25:02 +08:00
meetingId,
users: requesterUserId,
};
2017-06-06 03:12:06 +08:00
return Polls.find(selector);
}
function publish(...args) {
const boundPolls = polls.bind(this);
return mapToAcl('subscriptions.polls', boundPolls)(args);
}
Meteor.publish('polls', publish);