How can i access the details of the user who raise the request from a Model Hook
Comment.beforeSave = function(next,com) {
//Want to add 2 more properties
Faced with the same problem, I used node expiremantal domain feature (that intended for error handling).
Saving incoming request object:
// -- Your pre-processing middleware here --
app.use(function (req, res, next) {
// create per request domain instance
var domain = require('domain').create();
// save request to domain, to make it accessible everywhere
domain.req = req;
domain.run(next);
});
Next inside model hook you have access to req object, which is created per each connection:
process.domain.req
Also StrongLoop team added context propagation (based on continuation-local-storage), but it is not documented yet.