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 function setGuestPolicy(meetingId, guestPolicy) {
|
|
|
|
check(meetingId, String);
|
|
|
|
check(guestPolicy, String);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
2020-03-05 04:20:10 +08:00
|
|
|
'usersProp.guestPolicy': guestPolicy,
|
2020-02-04 04:41:12 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-03-12 20:22:08 +08:00
|
|
|
try {
|
|
|
|
const { numberAffected } = Meetings.upsert(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
|
|
|
}
|