2021-03-05 06:26:25 +08:00
|
|
|
import RedisPubSub from '/imports/startup/server/redis';
|
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
2021-05-06 02:53:13 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2021-03-05 06:26:25 +08:00
|
|
|
|
|
|
|
export default function removeGlobalAccess(whiteboardId) {
|
2021-05-06 02:53:13 +08:00
|
|
|
try {
|
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
|
|
|
const EVENT_NAME = 'ModifyWhiteboardAccessPubMsg';
|
2021-03-05 06:26:25 +08:00
|
|
|
|
2021-05-06 02:53:13 +08:00
|
|
|
check(whiteboardId, String);
|
2021-03-05 06:26:25 +08:00
|
|
|
|
2021-05-06 02:53:13 +08:00
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
2021-03-05 06:26:25 +08:00
|
|
|
|
2021-05-06 02:53:13 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
2021-03-05 06:26:25 +08:00
|
|
|
|
2021-05-06 02:53:13 +08:00
|
|
|
const payload = {
|
|
|
|
multiUser: [],
|
|
|
|
whiteboardId,
|
|
|
|
};
|
2021-03-05 06:26:25 +08:00
|
|
|
|
2021-05-06 02:53:13 +08:00
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Exception while invoking method removeGlobalAccess ${err.stack}`);
|
|
|
|
}
|
2021-03-05 06:26:25 +08:00
|
|
|
}
|