bigbluebutton-Github/bigbluebutton-html5/imports/api/annotations/server/methods/undoAnnotation.js
Oleksandr Zhurbenko 2de02c4f8d Linting
2018-01-07 16:25:56 -08:00

30 lines
1.0 KiB
JavaScript

import Acl from '/imports/startup/acl';
import { getMultiUserStatus } from '/imports/api/common/server/helpers';
import RedisPubSub from '/imports/startup/server/redis';
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
export default function undoAnnotation(credentials, whiteboardId) {
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'UndoWhiteboardPubMsg';
const { meetingId, requesterUserId, requesterToken } = credentials;
check(meetingId, String);
check(requesterUserId, String);
check(requesterToken, String);
check(whiteboardId, String);
const allowed = Acl.can('methods.undoAnnotation', credentials) || getMultiUserStatus(meetingId);
if (!allowed) {
throw new Meteor.Error('not-allowed', `User ${requesterUserId} is not allowed to undo the annotation`);
}
const payload = {
whiteboardId,
};
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
}