bigbluebutton-Github/bigbluebutton-html5/imports/startup/server/methods/setUserPresenter.js
2016-05-04 18:29:43 +00:00

33 lines
1.1 KiB
JavaScript

import { publish } from '/imports/startup/server/redispubsub';
import { isAllowedTo } from '/imports/startup/server/user_permissions';
import { appendMessageHeader } from '/imports/startup/server/helpers';
import { redisConfig } from '/config';
Meteor.methods({
//meetingId: the meeting where the user is
//newPresenterId: the userid of the new presenter
//requesterSetPresenter: the userid of the user that wants to change the presenter
//newPresenterName: user name of the new presenter
//authToken: the authToken of the user that wants to kick
setUserPresenter(
meetingId,
newPresenterId,
requesterSetPresenter,
newPresenterName,
authToken) {
let message;
if (isAllowedTo('setPresenter', meetingId, requesterSetPresenter, authToken)) {
message = {
payload: {
new_presenter_id: newPresenterId,
new_presenter_name: newPresenterName,
meeting_id: meetingId,
assigned_by: requesterSetPresenter,
}
};
}
message = appendMessageHeader('assign_presenter_request_message', message);
return publish(redisConfig.channels.toBBBApps.users, message);
}
});