bigbluebutton-Github/bigbluebutton-html5/imports/api/2.0/breakouts/server/publishers.js
2017-07-13 17:21:27 -03:00

32 lines
749 B
JavaScript

import { Meteor } from 'meteor/meteor';
import mapToAcl from '/imports/startup/mapToAcl';
import Breakouts from '/imports/api/2.0/breakouts';
import Logger from '/imports/startup/server/logger';
function breakouts(credentials) {
const {
meetingId,
requesterUserId,
} = credentials;
Logger.info(`Publishing Breakouts2x for ${meetingId} ${requesterUserId}`);
return Breakouts.find({
$or: [
{ breakoutMeetingId: meetingId },
{
users: {
$elemMatch: { userId: requesterUserId },
},
},
],
});
}
function publish(...args) {
const boundBreakouts = breakouts.bind(this);
return mapToAcl('subscriptions.breakouts', boundBreakouts)(args);
}
Meteor.publish('breakouts2x', publish);