bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/handleLockingMic.js
2016-05-12 17:43:59 +00:00

27 lines
926 B
JavaScript

import Users from '/imports/api/users/collection';
// when new lock settings including disableMic are set,
// all viewers that are in the audio bridge with a mic should be muted and locked
export function handleLockingMic(meetingId, newSettings) {
// send mute requests for the viewer users joined with mic
let i, results, userObject;
userObjects = Users.find({
meetingId: meetingId,
'user.role': 'VIEWER',
'user.listenOnly': false,
'user.locked': true,
'user.voiceUser.joined': true,
'user.voiceUser.muted': false,
}).fetch();
_userObjects_length = userObjects.length;
results = [];
for (i = 0; i < _userObjects_length; i++) {
userObject = userObjects[i];
results.push(Meteor.call('muteUser', meetingId, userObject.userId, userObject.userId,
userObject.authToken, true)); //true for muted
}
return results;
};