Created
July 8, 2016 21:30
-
-
Save gaboelnuevo/64be67f70ab81c9f5e849d5bf3cb73b7 to your computer and use it in GitHub Desktop.
Loopback.io current user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// common/models/model.js | |
app.models.Model.beforeRemote('create', function(ctx, modelInstance, next) { | |
ctx.args.data.userId = ctx.req.accessToken.userId; | |
next(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment