2016-05-17 02:05:44 +08:00
|
|
|
import Users from '/imports/api/users';
|
2016-05-13 01:43:59 +08:00
|
|
|
import { logger } from '/imports/startup/server/logger';
|
|
|
|
|
|
|
|
export function createDummyUser(meetingId, userId, authToken) {
|
2016-05-16 22:35:59 +08:00
|
|
|
if (Users.findOne({
|
|
|
|
userId: userId,
|
|
|
|
meetingId: meetingId,
|
|
|
|
authToken: authToken,
|
|
|
|
}) != null) {
|
|
|
|
const msg = `html5 user userId:[${userId}] from [${meetingId}] tried to revalidate token`;
|
|
|
|
return logger.info(msg);
|
|
|
|
} else {
|
|
|
|
return Users.insert({
|
|
|
|
meetingId: meetingId,
|
|
|
|
userId: userId,
|
|
|
|
authToken: authToken,
|
|
|
|
clientType: 'HTML5',
|
|
|
|
validated: false, //will be validated on validate_auth_token_reply
|
|
|
|
}, (err, id) => {
|
|
|
|
const res = Users.find({ meetingId: meetingId, }).count();
|
|
|
|
return logger.info(`_added a dummy html5 user userId=[${userId}] Users.size is now ${res}`);
|
|
|
|
});
|
|
|
|
}
|
2016-05-13 01:43:59 +08:00
|
|
|
};
|