tarlepp / angular-sailsjs-boilerplate

'Boilerplate' for AngularJS + Sails.js
MIT License
307 stars 87 forks source link

Adding user object into the request #68

Open eddieajau opened 9 years ago

eddieajau commented 9 years ago

I'm just wondering if there is a convenient location to add the user object into the request.

For example, the in isAdmin policy (see https://github.com/tarlepp/angular-sailsjs-boilerplate/blob/master/backend/api/policies/isAdmin.js#L16) you are finding the user. I will likely want a number of policies to access the user object, so is there a good place to set req.user?

Thanks in advance.

tarlepp commented 9 years ago

At this point "boilerplate" don't have really usage for this, but basically you have current user ID in request.token which is set on the authenticated policy (https://github.com/tarlepp/angular-sailsjs-boilerplate/blob/master/backend/api/policies/authenticated.js#L31) after user has been authenticated.

So basically that's the point that you're looking for. I hope this helps.

tarlepp commented 9 years ago

So did this help on your problem?

tarlepp commented 8 years ago

I'm still waiting for the answer for "So did this help on your problem?"