bigbluebutton-Github/bigbluebutton-html5/imports/api/presentation-upload-token/server/methods/setUsedToken.js

28 lines
728 B
JavaScript
Raw Normal View History

2019-07-12 01:46:44 +08:00
import PresentationUploadToken from '/imports/api/presentation-upload-token';
import Logger from '/imports/startup/server/logger';
import { extractCredentials } from '/imports/api/common/server/helpers';
2019-07-12 01:46:44 +08:00
export default function setUsedToken(authzToken) {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
2019-07-12 01:46:44 +08:00
const payload = {
$set: {
used: true,
},
};
const cb = (err) => {
if (err) {
Logger.error(`Unable to set token as used : ${err}`);
return;
}
Logger.info(`Token: ${authzToken} has been set as used in meeting=${meetingId}`);
2019-07-12 01:46:44 +08:00
};
2019-07-19 02:42:35 +08:00
return PresentationUploadToken.update({
meetingId,
userId: requesterUserId,
authzToken,
}, payload, cb);
2019-07-12 01:46:44 +08:00
}