bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/setApprovedStatus.js

32 lines
735 B
JavaScript
Raw Normal View History

2017-07-14 22:18:07 +08:00
import { check } from 'meteor/check';
import Users from '/imports/api/users';
2017-07-14 22:18:07 +08:00
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,
},
};
2017-07-15 03:25:04 +08:00
const cb = (err) => {
2017-07-14 22:18:07 +08:00
if (err) {
2017-07-15 03:25:04 +08:00
return Logger.error(`Updating approved status user=${userId}: ${err}`);
2017-07-14 22:18:07 +08:00
}
2017-07-15 03:25:04 +08:00
return Logger.info(`Updated approved status user=${userId} approved=${approved} meeting=${meetingId}`);
2017-07-14 22:18:07 +08:00
};
return Users.update(selector, modifier, cb);
}