2017-09-07 03:53:07 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import Users from '/imports/api/2.0/users';
|
|
|
|
import { check } from 'meteor/check';
|
|
|
|
|
|
|
|
export default function changeUserLock(meetingId, payload) {
|
|
|
|
check(meetingId, String);
|
2017-09-08 01:33:23 +08:00
|
|
|
check(payload, {
|
|
|
|
userId: String,
|
|
|
|
locked: Boolean,
|
|
|
|
lockedBy: String,
|
|
|
|
});
|
2017-09-07 03:53:07 +08:00
|
|
|
|
|
|
|
const selector = {
|
|
|
|
userId: payload.userId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
locked: payload.locked,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const cb = (err) => {
|
|
|
|
if (err) {
|
|
|
|
return Logger.error(`Changing user lock setting: ${err}`);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return Users.upsert(selector, modifier, cb);
|
2017-09-08 01:38:00 +08:00
|
|
|
};
|