bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/setApprovedStatus.js
2017-10-11 18:09:35 -07:00

32 lines
739 B
JavaScript

import { check } from 'meteor/check';
import Users from '/imports/api/2.0/users';
import Logger from '/imports/startup/server/logger';
export default function setApprovedStatus(meetingId, userId, approved = false, approvedBy = null) {
check(meetingId, String);
check(userId, String);
check(approved, Boolean);
const selector = {
meetingId,
userId,
};
const modifier = {
$set: {
approved,
approvedBy,
},
};
const cb = (err) => {
if (err) {
return Logger.error(`Updating approved status user=${userId}: ${err}`);
}
return Logger.info(`Updated approved status user=${userId} approved=${approved} meeting=${meetingId}`);
};
return Users.update(selector, modifier, cb);
}