Windshaft-cartodb/lib/cartodb/middleware/user.js
Raul Ochoa 9cd67f06c1 User extraction from request middleware
Used only where potentially a user is required.

It doesn't make sense to extract a user for request that don't need
a user in the context.
2015-09-30 17:17:01 +02:00

8 lines
211 B
JavaScript

var CdbRequest = require('../models/cdb_request');
var cdbRequest = new CdbRequest();
module.exports = function userMiddleware(req, res, next) {
req.context.user = cdbRequest.userByReq(req);
next();
};