Added an endpoint to get the user referenced by the given token

This commit is contained in:
mayjs 2017-05-15 18:44:54 +02:00
parent 609a8894ec
commit fa928956c2

View file

@ -527,6 +527,16 @@ if (Meteor.isServer) {
// USERS REST API
if (Meteor.isServer) {
JsonRoutes.add('GET', '/api/user', function(req, res, next) {
Authentication.checkLoggedIn(req.userId);
let data = Meteor.users.findOne({ _id: req.userId});
delete data.services;
JsonRoutes.sendResult(res, {
code: 200,
data
});
});
JsonRoutes.add('GET', '/api/users', function (req, res, next) {
Authentication.checkUserId( req.userId);
JsonRoutes.sendResult(res, {