bigbluebutton-Github/bigbluebutton-html5/imports/api/meetings/server/modifiers/setGuestPolicy.js

29 lines
686 B
JavaScript
Raw Normal View History

2020-02-04 04:41:12 +08:00
import Meetings from '/imports/api/meetings';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
export default async function setGuestPolicy(meetingId, guestPolicy) {
2020-02-04 04:41:12 +08:00
check(meetingId, String);
check(guestPolicy, String);
const selector = {
meetingId,
};
const modifier = {
$set: {
'usersProp.guestPolicy': guestPolicy,
2020-02-04 04:41:12 +08:00
},
};
2021-03-12 20:22:08 +08:00
try {
const { numberAffected } = await Meetings.upsertAsync(selector, modifier);
2020-02-04 04:41:12 +08:00
2021-03-12 20:22:08 +08:00
if (numberAffected) {
Logger.verbose(`Set guest policy meetingId=${meetingId} guestPolicy=${guestPolicy}`);
2020-02-04 04:41:12 +08:00
}
2021-03-12 20:22:08 +08:00
} catch (err) {
Logger.error(`Setting guest policy: ${err}`);
}
2020-02-04 04:41:12 +08:00
}