Fix publishers access for moderators

This commit is contained in:
Tainan Felipe 2019-03-07 17:23:42 -03:00
parent 32f5168090
commit 160c0669f8
3 changed files with 28 additions and 17 deletions

View File

@ -1,8 +1,9 @@
import { Meteor } from 'meteor/meteor';
import Breakouts from '/imports/api/breakouts';
import Users from '/imports/api/users';
import Logger from '/imports/startup/server/logger';
function breakouts(credentials, moderator) {
function breakouts(credentials, moderator = false) {
const {
meetingId,
requesterUserId,
@ -10,14 +11,17 @@ function breakouts(credentials, moderator) {
Logger.info(`Publishing Breakouts for ${meetingId} ${requesterUserId}`);
if (moderator) {
const presenterSelector = {
$or: [
{ parentMeetingId: meetingId },
{ breakoutId: meetingId },
],
};
const User = Users.findOne({ userId: requesterUserId });
if (User.moderator) {
const presenterSelector = {
$or: [
{ parentMeetingId: meetingId },
{ breakoutId: meetingId },
],
};
return Breakouts.find(presenterSelector);
return Breakouts.find(presenterSelector);
}
}
const selector = {

View File

@ -1,6 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import Meetings from '/imports/api/meetings';
import Users from '/imports/api/users';
import Logger from '/imports/startup/server/logger';
function meetings(credentials, isModerator = false) {
@ -19,10 +20,13 @@ function meetings(credentials, isModerator = false) {
};
if (isModerator) {
selector.$or.push({
'meetingProp.isBreakout': true,
'breakoutProps.parentId': meetingId,
});
const User = Users.findOne({ userId: requesterUserId });
if (User.moderator) {
selector.$or.push({
'meetingProp.isBreakout': true,
'breakoutProps.parentId': meetingId,
});
}
}
const options = {

View File

@ -57,11 +57,14 @@ function users(credentials, isModerator = false) {
};
if (isModerator) {
selector.$or.push({
'breakoutProps.isBreakoutUser': true,
'breakoutProps.parentId': meetingId,
connectionStatus: 'online',
});
const User = Users.findOne({ userId: requesterUserId });
if (User.moderator) {
selector.$or.push({
'breakoutProps.isBreakoutUser': true,
'breakoutProps.parentId': meetingId,
connectionStatus: 'online',
});
}
}
const options = {