bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/methods/validateAuthToken.js
Anton Georgiev a263c1388b lint mostly
2016-05-16 14:35:59 +00:00

35 lines
1.1 KiB
JavaScript

import { logger } from '/imports/startup/server/logger';
import { redisConfig } from '/config';
import { createDummyUser } from '/imports/api/users/server/modifiers/createDummyUser';
import { publish } from '/imports/startup/server/helpers';
Meteor.methods({
// Construct and send a message to bbb-web to validate the user
validateAuthToken(meetingId, userId, authToken) {
logger.info('sending a validate_auth_token with', {
userid: userId,
authToken: authToken,
meetingid: meetingId,
});
let message = {
payload: {
auth_token: authToken,
userid: userId,
meeting_id: meetingId,
},
header: {
timestamp: new Date().getTime(),
reply_to: `${meetingId}/${userId}`,
name: 'validate_auth_token',
},
};
if ((authToken != null) && (userId != null) && (meetingId != null)) {
createDummyUser(meetingId, userId, authToken);
return publish(redisConfig.channels.toBBBApps.meeting, message);
} else {
return logger.info('did not have enough information to send a validate_auth_token message');
}
},
});